]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
cgroup/bpf: only cgroup v2 can be attached by bpf programs
authorChen Ridong <chenridong@huawei.com>
Fri, 18 Oct 2024 08:15:20 +0000 (08:15 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 14 Dec 2024 18:50:48 +0000 (19:50 +0100)
commit973c859752cbe1e80135fee228efcbd9260f9e91
tree1a40b86f03a69eb4fc6fcf67ea45a38f31e04880
parentd4cc5a87c24d805363d93f499908e5b932f81ab5
cgroup/bpf: only cgroup v2 can be attached by bpf programs

[ Upstream commit 2190df6c91373fdec6db9fc07e427084f232f57e ]

Only cgroup v2 can be attached by bpf programs, so this patch introduces
that cgroup_bpf_inherit and cgroup_bpf_offline can only be called in
cgroup v2, and this can fix the memleak mentioned by commit 04f8ef5643bc
("cgroup: Fix memory leak caused by missing cgroup_bpf_offline"), which
has been reverted.

Fixes: 2b0d3d3e4fcf ("percpu_ref: reduce memory footprint of percpu_ref in fast path")
Fixes: 4bfc0bb2c60e ("bpf: decouple the lifetime of cgroup_bpf from cgroup itself")
Link: https://lore.kernel.org/cgroups/aka2hk5jsel5zomucpwlxsej6iwnfw4qu5jkrmjhyfhesjlfdw@46zxhg5bdnr7/
Signed-off-by: Chen Ridong <chenridong@huawei.com>
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/cgroup/cgroup.c