summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLi Zefan <lizefan@huawei.com>2013-07-31 16:16:28 +0800
committerTejun Heo <tj@kernel.org>2013-07-31 06:13:25 -0400
commitda0a12caffad2eeadea429f83818408e7b77379a (patch)
tree3ff7fa3a5b2156066b442ef126db9dacab008c87
parent913ffdb54366f94eec65c656cae8c6e00e1ab1b0 (diff)
downloadlinux-da0a12caffad2eeadea429f83818408e7b77379a.tar.bz2
cgroup: fix a leak when percpu_ref_init() fails
ss->css_free() is not called when perfcpu_ref_init() fails. Signed-off-by: Li Zefan <lizefan@huawei.com> Signed-off-by: Tejun Heo <tj@kernel.org>
-rw-r--r--kernel/cgroup.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index afb8d53ca6c7..468e410f9e61 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4344,8 +4344,10 @@ static long cgroup_create(struct cgroup *parent, struct dentry *dentry,
}
err = percpu_ref_init(&css->refcnt, css_release);
- if (err)
+ if (err) {
+ ss->css_free(cgrp);
goto err_free_all;
+ }
init_cgroup_css(css, ss, cgrp);