Skip to content

libbpf: Fix null pointer dereference in btf_dump__free on allocation failure #9136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: bpf-next_base
Choose a base branch
from

Conversation

kernel-patches-daemon-bpf[bot]
Copy link

Pull request for series with
subject: libbpf: Fix null pointer dereference in btf_dump__free on allocation failure
version: 1
url: https://patchwork.kernel.org/project/netdevbpf/list/?series=972865

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: f66b4aa
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=972865
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: a633dab
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=972865
version: 1

@kernel-patches-daemon-bpf
Copy link
Author

At least one diff in series https://patchwork.kernel.org/project/netdevbpf/list/?series=972865 expired. Closing PR.

@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: bd07bd1
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=973172
version: 2

…failure

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.

Fix: 351131b ("libbpf: add btf_dump API for BTF-to-C conversion")
Signed-off-by: chenyuan <[email protected]>
@kernel-patches-daemon-bpf
Copy link
Author

Upstream branch: cd7312a
series: https://patchwork.kernel.org/project/netdevbpf/list/?series=973172
version: 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant