]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm/slab_common.c: clear pointers to per memcg caches on destroy
authorVladimir Davydov <vdavydov@virtuozzo.com>
Wed, 21 Oct 2015 22:02:51 +0000 (09:02 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Oct 2015 22:02:51 +0000 (09:02 +1100)
commit7b9ceb6a2e4c7e9c40a584e39651cc1523d511eb
tree8d4027005e1f6012e2f70e38e3e8f753aa70c509
parent7fd0aad3be0b761e70d17ae837735789b044474c
mm/slab_common.c: clear pointers to per memcg caches on destroy

Currently, we do not clear pointers to per memcg caches in the
memcg_params.memcg_caches array when a global cache is destroyed with
kmem_cache_destroy.

This is fine if the global cache does get destroyed.  However, a cache can
be left on the list if it still has active objects when kmem_cache_destroy
is called (due to a memory leak).  If this happens, the entries in the
array will point to already freed areas, which is likely to result in data
corruption when the cache is reused (via slab merging).

Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/slab.h
mm/slab_common.c