diff options
author | Li Zefan <[email protected]> | 2013-04-29 15:08:43 -0700 |
---|---|---|
committer | Linus Torvalds <[email protected]> | 2013-04-29 15:54:39 -0700 |
commit | fd0ccaf2bd04e54d2a6979fbfdcad856694e3877 (patch) | |
tree | 62ea631673d80a7f75c78cb601d0e2946fc4ad05 | |
parent | 865ffef3797da2cac85b3354b5b6050dc9660978 (diff) |
memcg: avoid accessing memcg after releasing reference
This might cause a use-after-free bug.
Signed-off-by: Li Zefan <[email protected]>
Cc: Glauber Costa <[email protected]>
Acked-by: Michal Hocko <[email protected]>
Acked-by: KAMEZAWA Hiroyuki <[email protected]>
Cc: Johannes Weiner <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
-rw-r--r-- | mm/memcontrol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 360464f40e96..c92bcfc5466e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -3215,12 +3215,12 @@ void memcg_release_cache(struct kmem_cache *s) root = s->memcg_params->root_cache; root->memcg_params->memcg_caches[id] = NULL; - mem_cgroup_put(memcg); mutex_lock(&memcg->slab_caches_mutex); list_del(&s->memcg_params->list); mutex_unlock(&memcg->slab_caches_mutex); + mem_cgroup_put(memcg); out: kfree(s->memcg_params); } |