diff options
author | Yuan Chen <chenyuan@kylinos.cn> | 2025-06-18 09:19:33 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-07-06 11:04:14 +0200 |
commit | 8f032e5eb6e353cc97f5aa375c3093fa5922e0ee (patch) | |
tree | 6c25449d65ea660b3698cb564e7e6a99b49237d6 /tools/perf/scripts/python | |
parent | 15633fe1f06d0e6a95502d6f07cf391a07a820a5 (diff) |
libbpf: Fix null pointer dereference in btf_dump__free on allocation failure
[ Upstream commit aa485e8789d56a4573f7c8d000a182b749eaa64d ]
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: 351131b51c7a ("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>
Diffstat (limited to 'tools/perf/scripts/python')
0 files changed, 0 insertions, 0 deletions