Commit ddead183 authored by Mykyta Yatsenko's avatar Mykyta Yatsenko Committed by Greg Kroah-Hartman
Browse files

libbpf: Check bpf_map_skeleton link for NULL



[ Upstream commit d0445d7d ]

Avoid dereferencing bpf_map_skeleton's link field if it's NULL.
If BPF map skeleton is created with the size, that indicates containing
link field, but the field was not actually initialized with valid
bpf_link pointer, libbpf crashes. This may happen when using libbpf-rs
skeleton.
Skeleton loading may still progress, but user needs to attach struct_ops
map separately.

Signed-off-by: default avatarMykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250514113220.219095-1-mykyta.yatsenko5@gmail.com


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