aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorLi Zefan <lizefan@huawei.com>2013-04-29 18:08:43 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2013-04-29 18:54:39 -0400
commitfd0ccaf2bd04e54d2a6979fbfdcad856694e3877 (patch)
tree62ea631673d80a7f75c78cb601d0e2946fc4ad05 /mm
parent865ffef3797da2cac85b3354b5b6050dc9660978 (diff)
memcg: avoid accessing memcg after releasing reference
This might cause a use-after-free bug. Signed-off-by: Li Zefan <lizefan@huawei.com> Cc: Glauber Costa <glommer@parallels.com> Acked-by: Michal Hocko <mhocko@suse.cz> Acked-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> Cc: Johannes Weiner <hannes@cmpxchg.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/memcontrol.c2
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)
3215 3215
3216 root = s->memcg_params->root_cache; 3216 root = s->memcg_params->root_cache;
3217 root->memcg_params->memcg_caches[id] = NULL; 3217 root->memcg_params->memcg_caches[id] = NULL;
3218 mem_cgroup_put(memcg);
3219 3218
3220 mutex_lock(&memcg->slab_caches_mutex); 3219 mutex_lock(&memcg->slab_caches_mutex);
3221 list_del(&s->memcg_params->list); 3220 list_del(&s->memcg_params->list);
3222 mutex_unlock(&memcg->slab_caches_mutex); 3221 mutex_unlock(&memcg->slab_caches_mutex);
3223 3222
3223 mem_cgroup_put(memcg);
3224out: 3224out:
3225 kfree(s->memcg_params); 3225 kfree(s->memcg_params);
3226} 3226}