From: Glauber Costa Date: Wed, 20 Feb 2013 02:14:47 +0000 (+1100) Subject: memcg: avoid dangling reference count in creation failure. X-Git-Tag: next-20130220~1^2~438 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=b8551182cba09339e98c3d72c51b76e1483ee48c;p=karo-tx-linux.git memcg: avoid dangling reference count in creation failure. When use_hierarchy is enabled, we acquire an extra reference count in our parent during cgroup creation. We don't release it, though, if any failure exist in the creation process. Signed-off-by: Glauber Costa Reported-by: Michal Hocko Acked-by: Michal Hocko Cc: Tejun Heo Cc: Hiroyuki Kamezawa Cc: Johannes Weiner Signed-off-by: Andrew Morton --- diff --git a/mm/memcontrol.c b/mm/memcontrol.c index f4f41c36e703..60d28e36f0e0 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -6196,6 +6196,8 @@ 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; }