mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Cc: Christoph Lameter <[email protected]> Cc: Pekka Enberg <[email protected]> Cc: David Rientjes <[email protected]> Cc: Joonsoo Kim <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
c9a77a7920
commit
d60fdcc9e3
2 changed files with 78 additions and 21 deletions
|
|
@ -181,10 +181,6 @@ bool __kmem_cache_alloc_bulk(struct kmem_cache *, gfp_t, size_t, void **);
|
|||
list_for_each_entry(iter, &(root)->memcg_params.list, \
|
||||
memcg_params.list)
|
||||
|
||||
#define for_each_memcg_cache_safe(iter, tmp, root) \
|
||||
list_for_each_entry_safe(iter, tmp, &(root)->memcg_params.list, \
|
||||
memcg_params.list)
|
||||
|
||||
static inline bool is_root_cache(struct kmem_cache *s)
|
||||
{
|
||||
return s->memcg_params.is_root_cache;
|
||||
|
|
@ -265,8 +261,6 @@ extern void slab_init_memcg_params(struct kmem_cache *);
|
|||
|
||||
#define for_each_memcg_cache(iter, root) \
|
||||
for ((void)(iter), (void)(root); 0; )
|
||||
#define for_each_memcg_cache_safe(iter, tmp, root) \
|
||||
for ((void)(iter), (void)(tmp), (void)(root); 0; )
|
||||
|
||||
static inline bool is_root_cache(struct kmem_cache *s)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue