diff options
author | Glauber Costa <glommer@parallels.com> | 2013-02-22 19:34:57 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-02-23 20:50:18 -0500 |
commit | e4715f01be697a3730c78f8ffffb595591d6a88c (patch) | |
tree | 6ba363f7454d0b8e6b4db8997c8b7fa587f20279 /mm/memcontrol.c | |
parent | 692e89abd154b04d212dce0c18a449bda15aac04 (diff) |
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 <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>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memcontrol.c')
-rw-r--r-- | mm/memcontrol.c | 2 |
1 files changed, 2 insertions, 0 deletions
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) | |||
6196 | * call __mem_cgroup_free, so return directly | 6196 | * call __mem_cgroup_free, so return directly |
6197 | */ | 6197 | */ |
6198 | mem_cgroup_put(memcg); | 6198 | mem_cgroup_put(memcg); |
6199 | if (parent->use_hierarchy) | ||
6200 | mem_cgroup_put(parent); | ||
6199 | } | 6201 | } |
6200 | return error; | 6202 | return error; |
6201 | } | 6203 | } |