提交 e58c5c97 编写于 作者: H Haowen Bai 提交者: Andrii Nakryiko

libbpf: Potential NULL dereference in usdt_manager_attach_usdt()

link could be null but still dereference bpf_link__destroy(&link->link)
and it will lead to a null pointer access.
Signed-off-by: NHaowen Bai <baihaowen@meizu.com>
Signed-off-by: NAndrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/bpf/1649299098-2069-1-git-send-email-baihaowen@meizu.com
上级 502b0e3d
...@@ -1071,8 +1071,8 @@ struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct ...@@ -1071,8 +1071,8 @@ struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct
return &link->link; return &link->link;
err_out: err_out:
bpf_link__destroy(&link->link); if (link)
bpf_link__destroy(&link->link);
free(targets); free(targets);
hashmap__free(specs_hash); hashmap__free(specs_hash);
if (elf) if (elf)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册