diff options
author | Daniel T. Lee <[email protected]> | 2020-04-10 11:06:12 +0900 |
---|---|---|
committer | Daniel Borkmann <[email protected]> | 2020-04-14 21:33:53 +0200 |
commit | 96b2eb6e77959b4b52f80e7a61d03db77606aac6 (patch) | |
tree | 4b2925662cb05bc2667f432372bcbc02956b0439 /scripts/bpf_helpers_doc.py | |
parent | 642c1654702731ab42a3be771bebbd6ef938f0dc (diff) |
tools, bpftool: Fix struct_ops command invalid pointer free
In commit 65c93628599d ("bpftool: Add struct_ops support") a new
type of command named struct_ops has been added. This command requires
a kernel with CONFIG_DEBUG_INFO_BTF=y set and for retrieving BTF info
in bpftool, the helper get_btf_vmlinux() is used.
When running this command on kernel without BTF debug info, this will
lead to 'btf_vmlinux' variable being an invalid(error) pointer. And by
this, btf_free() causes a segfault when executing 'bpftool struct_ops'.
This commit adds pointer validation with IS_ERR not to free invalid
pointer, and this will fix the segfault issue.
Fixes: 65c93628599d ("bpftool: Add struct_ops support")
Signed-off-by: Daniel T. Lee <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Acked-by: Martin KaFai Lau <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'scripts/bpf_helpers_doc.py')
0 files changed, 0 insertions, 0 deletions