]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
bpf: Use function pointers count as struct_ops links count
authorXu Kuohai <xukuohai@huawei.com>
Tue, 12 Nov 2024 14:58:48 +0000 (22:58 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Dec 2024 12:53:25 +0000 (13:53 +0100)
commit2a99cb07a460714a6118cb17c43390e95bcb9fdd
tree0bf1dc64b8b5cfd8d01209ec74f164bc5477006b
parent715f54ef0c91ad7b19f541552f55975d79002f3f
bpf: Use function pointers count as struct_ops links count

[ Upstream commit 821a3fa32bbe3bc0fa23b3189325d3720a49a24c ]

Only function pointers in a struct_ops structure can be linked to bpf
progs, so set the links count to the function pointers count, instead
of the total members count in the structure.

Suggested-by: Martin KaFai Lau <martin.lau@linux.dev>
Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Link: https://lore.kernel.org/r/20241112145849.3436772-3-xukuohai@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Stable-dep-of: 7c8ce4ffb684 ("bpf: Add kernel symbol for struct_ops trampoline")
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/bpf_struct_ops.c