diff options
author | Vladimir Davydov <[email protected]> | 2014-04-07 15:39:27 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2014-04-07 16:36:12 -0700 |
commit | 051dd46050f2a9bdfff8cc067f8987069eae1743 (patch) | |
tree | 64ccd763fcdda9a1087063f154f0d96fc6ab573a /include/linux/fpga/fpga-mgr.h | |
parent | 794b1248be4e7e157f5535c3ee49168aa4643349 (diff) |
memcg, slab: unregister cache from memcg before starting to destroy it
Currently, memcg_unregister_cache(), which deletes the cache being
destroyed from the memcg_slab_caches list, is called after
__kmem_cache_shutdown() (see kmem_cache_destroy()), which starts to
destroy the cache.
As a result, one can access a partially destroyed cache while traversing
a memcg_slab_caches list, which can have deadly consequences (for
instance, cache_show() called for each cache on a memcg_slab_caches list
from mem_cgroup_slabinfo_read() will dereference pointers to already
freed data).
To fix this, let's move memcg_unregister_cache() before the cache
destruction process beginning, issuing memcg_register_cache() on failure.
Signed-off-by: Vladimir Davydov <[email protected]>
Cc: Michal Hocko <[email protected]>
Cc: Johannes Weiner <[email protected]>
Cc: David Rientjes <[email protected]>
Cc: Pekka Enberg <[email protected]>
Cc: Glauber Costa <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
Diffstat (limited to 'include/linux/fpga/fpga-mgr.h')
0 files changed, 0 insertions, 0 deletions