linux-yocto/tools/lib/bpf
Yuan Chen 1197abb1ee libbpf: Fix null pointer dereference in btf_dump__free on allocation failure
[ Upstream commit aa485e8789 ]

When btf_dump__new() fails to allocate memory for the internal hashmap
(btf_dump->type_names), it returns an error code. However, the cleanup
function btf_dump__free() does not check if btf_dump->type_names is NULL
before attempting to free it. This leads to a null pointer dereference
when btf_dump__free() is called on a btf_dump object.

Fixes: 351131b51c ("libbpf: add btf_dump API for BTF-to-C conversion")
Signed-off-by: Yuan Chen <chenyuan@kylinos.cn>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/20250618011933.11423-1-chenyuan_fl@163.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
2025-07-10 15:57:38 +02:00
..
.gitignore libbpf: Stop using feature-detection Makefiles 2021-02-04 01:22:00 +01:00
bpf_core_read.h bpf: Fix uninitialized values in BPF_{CORE,PROBE}_READ 2025-06-27 11:05:12 +01:00
bpf_endian.h
bpf_gen_internal.h libbpf: Cleanup temp FDs when intermediate sys_bpf fails. 2021-05-19 00:40:44 +02:00
bpf_helpers.h libbpf: fix offsetof() and container_of() to work with CO-RE 2023-07-23 13:46:49 +02:00
bpf_prog_linfo.c libbpf: Streamline error reporting for high-level APIs 2021-05-25 17:32:35 -07:00
bpf_tracing.h libbpf: Fail compilation if target arch is missing 2021-06-16 20:15:30 -07:00
bpf.c libbpf: Fix lookup_and_delete_elem_flags error reporting 2021-11-18 19:17:09 +01:00
bpf.h libbpf: Avoid enum forward-declarations in public API in C++ mode 2022-12-31 13:14:43 +01:00
btf_dump.c libbpf: Fix null pointer dereference in btf_dump__free on allocation failure 2025-07-10 15:57:38 +02:00
btf.c libbpf: Add identical pointer detection to btf_dedup_is_equiv() 2025-06-27 11:05:32 +01:00
btf.h libbpf: Fix potential misaligned memory access in btf_ext__new() 2022-01-27 11:03:16 +01:00
Build libbpf: Split CO-RE logic into relo_core.c. 2021-07-26 12:29:14 -07:00
gen_loader.c libbpf: fix an snprintf() overflow check 2022-08-17 14:23:32 +02:00
hashmap.c
hashmap.h
libbpf_common.h
libbpf_errno.c libbpf: Streamline error reporting for high-level APIs 2021-05-25 17:32:35 -07:00
libbpf_internal.h libbpf: Add bpf_cookie support to bpf_link_create() API 2021-08-17 00:45:08 +02:00
libbpf_legacy.h libbpf: Streamline error reporting for low-level APIs 2021-05-25 17:32:35 -07:00
libbpf_probes.c libbpf: Use page size as max_entries when probing ring buffer map 2022-12-19 12:36:41 +01:00
libbpf.c libbpf: Fix buffer overflow in bpf_object__init_prog 2025-06-27 11:05:12 +01:00
libbpf.h libbpf: Add uprobe ref counter offset support for USDT semaphores 2021-08-17 00:45:08 +02:00
libbpf.map libbpf: Add bpf_cookie to perf_event, kprobe, uprobe, and tp attach APIs 2021-08-17 00:45:08 +02:00
libbpf.pc.template
linker.c libbpf: Use proper errno value in linker 2025-06-27 11:05:12 +01:00
Makefile libbpf: Fix build issue with llvm-readelf 2022-04-13 20:59:03 +02:00
netlink.c libbpf: Fix memleak in libbpf_netlink_recv() 2022-04-08 14:23:31 +02:00
nlattr.c libbpf: Use proper errno value in nlattr 2025-06-27 11:05:13 +01:00
nlattr.h libbpf: Switch to void * casting in netlink helpers 2021-06-22 17:04:02 +02:00
relo_core.c libbpf: Split CO-RE logic into relo_core.c. 2021-07-26 12:29:14 -07:00
relo_core.h libbpf: Split CO-RE logic into relo_core.c. 2021-07-26 12:29:14 -07:00
ringbuf.c libbpf: Handle size overflow for ringbuf mmap 2022-12-08 11:28:39 +01:00
skel_internal.h libbpf: Fix skel_internal.h to set errno on loader retval < 0 2021-11-18 19:16:27 +01:00
str_error.c
str_error.h
strset.c libbpf: Fix memory leak in strset 2021-10-01 22:54:38 +02:00
strset.h libbpf: Extract internal set-of-strings datastructure APIs 2021-03-18 16:14:22 -07:00
xsk.c selftests/xsk: Avoid use-after-free on ctx 2022-10-26 12:34:41 +02:00
xsk.h libbpf: xsk: Move barriers from libbpf_util.h to xsk.h 2021-03-10 13:45:16 -08:00