]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
Revert "cgroup: Fix memory leak caused by missing cgroup_bpf_offline"
authorChen Ridong <chenridong@huawei.com>
Fri, 18 Oct 2024 08:15:19 +0000 (08:15 +0000)
committerTejun Heo <tj@kernel.org>
Mon, 21 Oct 2024 20:02:26 +0000 (10:02 -1000)
This reverts commit 04f8ef5643bcd8bcde25dfdebef998aea480b2ba.

Only cgroup v2 can be attached by cgroup by BPF programs. Revert this
commit and cgroup_bpf_inherit and cgroup_bpf_offline won't be called in
cgroup v1. The memory leak issue will be fixed with next patch.

Fixes: 04f8ef5643bc ("cgroup: Fix memory leak caused by missing cgroup_bpf_offline")
Link: https://lore.kernel.org/cgroups/aka2hk5jsel5zomucpwlxsej6iwnfw4qu5jkrmjhyfhesjlfdw@46zxhg5bdnr7/
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
kernel/cgroup/cgroup.c

index 5886b95c6eaee60e12d5035e4eee41964ed47e9a..5c6d32054e077f8a4067fd0b2d75736ac4a84f22 100644 (file)
@@ -2314,10 +2314,8 @@ static void cgroup_kill_sb(struct super_block *sb)
         * And don't kill the default root.
         */
        if (list_empty(&root->cgrp.self.children) && root != &cgrp_dfl_root &&
-           !percpu_ref_is_dying(&root->cgrp.self.refcnt)) {
-               cgroup_bpf_offline(&root->cgrp);
+           !percpu_ref_is_dying(&root->cgrp.self.refcnt))
                percpu_ref_kill(&root->cgrp.self.refcnt);
-       }
        cgroup_put(&root->cgrp);
        kernfs_kill_sb(sb);
 }