Commit d5092b0a authored by Hou Tao's avatar Hou Tao Committed by Greg Kroah-Hartman
Browse files

bpf: Check validity of link->type in bpf_link_show_fdinfo()



[ Upstream commit 8421d4c8 ]

If a newly-added link type doesn't invoke BPF_LINK_TYPE(), accessing
bpf_link_type_strs[link->type] may result in an out-of-bounds access.

To spot such missed invocations early in the future, checking the
validity of link->type in bpf_link_show_fdinfo() and emitting a warning
when such invocations are missed.

Signed-off-by: default avatarHou Tao <houtao1@huawei.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20241024013558.1135167-3-houtao@huaweicloud.com


Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 9dcf6961
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment