Skip to content

Commit

Permalink
cgroup: fix a leak when percpu_ref_init() fails
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Li Zefan authored and Tejun Heo committed Jul 31, 2013
1 parent 913ffdb commit da0a12c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion kernel/cgroup.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit da0a12c

Please sign in to comment.