]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
memcg: avoid dangling reference count in creation failure.
authorGlauber Costa <glommer@parallels.com>
Thu, 7 Feb 2013 01:26:58 +0000 (12:26 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Mon, 18 Feb 2013 05:46:46 +0000 (16:46 +1100)
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 <glommer@parallels.com>
Reported-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Tejun Heo <tj@kernel.org>
Cc: Hiroyuki Kamezawa <kamezawa.hiroyuki@gmail.com>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/memcontrol.c

index f9592450dbe3ae59064cba9ee806410fd13c9942..2fd0efd456668c30b2ef251daf0115878ba2e2ff 100644 (file)
@@ -6197,6 +6197,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;
 }