cgroup: fix cgroup refcnt leak
PATCH 1/1 cgroup: fix cgroup refcnt leak
Currently, we get refcnt twice if a new root isn't created.
percpu_ref_tryget_live() is called and then cgroup_get() is called too.
Fixes aea3f2676c83 ("kernfs, sysfs, cgroup, intel_rdt: Support fs_context")
Signed-off-by Andrei Vagin <[email protected]>
--- kernel/cgroup/cgroup-v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/cgroup/cgroup-v1.c +1 -1
@@ -1280,8 +1280,8 @@ int cgroup1_get_tree(struct fs_context *fc)mutex_lock (&cgroup_mutex);percpu_ref_reinit (&root->cgrp.self.refcnt);mutex_unlock (&cgroup_mutex); +cgroup_get (&root->cgrp); } -cgroup_get (&root->cgrp);/* * If @pinned_sb, we're reusing an existing root and holding an
Signature · 1 line
2.17.2
Pls, ignore this patch.
Quoted 27 lines · Andrei Vagin
Currently, we get refcnt twice if a new root isn't created.
percpu_ref_tryget_live()is called and thencgroup_get()is called too.Fixes aea3f2676c83 ("kernfs, sysfs, cgroup, intel_rdt: Support fs_context")Signed-off-by Andrei Vagin <[email protected]>--- kernel/cgroup/cgroup-v1.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)kernel/cgroup/cgroup-v1.c +1
-1@@ -1280,8 +1280,8 @@ int cgroup1_get_tree(struct fs_context *fc)mutex_lock (&cgroup_mutex);percpu_ref_reinit (&root->cgrp.self.refcnt);mutex_unlock (&cgroup_mutex); +cgroup_get (&root->cgrp); } -cgroup_get (&root->cgrp);/* * If @pinned_sb, we're reusing an existing root and holding an Signature · 1 line
2.17.2