Commit d0445d7
libbpf: Check bpf_map_skeleton link for NULL
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: Mykyta Yatsenko <yatsenko@meta.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250514113220.219095-1-mykyta.yatsenko5@gmail.com1 parent bc04938 commit d0445d7
1 file changed
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
14102 | 14102 | | |
14103 | 14103 | | |
14104 | 14104 | | |
| 14105 | + | |
| 14106 | + | |
| 14107 | + | |
| 14108 | + | |
| 14109 | + | |
| 14110 | + | |
14105 | 14111 | | |
14106 | 14112 | | |
14107 | 14113 | | |
| |||
0 commit comments