From: Michal Hocko Date: Mon, 8 Jul 2013 23:00:27 +0000 (-0700) Subject: Revert "memcg: avoid dangling reference count in creation failure" X-Git-Tag: firefly_0821_release~6453^2~1591 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=9cafb55474a872531d0b9bf429346912ae5f1153;p=firefly-linux-kernel-4.4.55.git Revert "memcg: avoid dangling reference count in creation failure" commit fa460c2d37870e0a6f94c70e8b76d05ca11b6db0 upstream. This reverts commit e4715f01be697a. mem_cgroup_put is hierarchy aware so mem_cgroup_put(memcg) already drops an additional reference from all parents so the additional mem_cgrroup_put(parent) potentially causes use-after-free. Signed-off-by: Michal Hocko Signed-off-by: Li Zefan Acked-by: KAMEZAWA Hiroyuki Cc: Hugh Dickins Cc: Tejun Heo Cc: Glauber Costa Cc: Johannes Weiner Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 194721839cf5..fd79df5d3152 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6303,8 +6303,6 @@ mem_cgroup_css_online(struct cgroup *cont) * call __mem_cgroup_free, so return directly */ mem_cgroup_put(memcg); - if (parent->use_hierarchy) - mem_cgroup_put(parent); } return error; }