projects
/
platform
/
kernel
/
linux-rpi.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
502b0e3
)
libbpf: Potential NULL dereference in usdt_manager_attach_usdt()
author
Haowen Bai
<baihaowen@meizu.com>
Thu, 7 Apr 2022 02:38:17 +0000
(10:38 +0800)
committer
Andrii Nakryiko
<andrii@kernel.org>
Thu, 7 Apr 2022 18:46:33 +0000
(11:46 -0700)
link could be null but still dereference bpf_link__destroy(&link->link)
and it will lead to a null pointer access.
Signed-off-by: Haowen Bai <baihaowen@meizu.com>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link:
https://lore.kernel.org/bpf/1649299098-2069-1-git-send-email-baihaowen@meizu.com
tools/lib/bpf/usdt.c
patch
|
blob
|
history
diff --git
a/tools/lib/bpf/usdt.c
b/tools/lib/bpf/usdt.c
index
c5acf28
..
bb1e886
100644
(file)
--- a/
tools/lib/bpf/usdt.c
+++ b/
tools/lib/bpf/usdt.c
@@
-1071,8
+1071,8
@@
struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct
return &link->link;
err_out:
- bpf_link__destroy(&link->link);
-
+ if (link)
+ bpf_link__destroy(&link->link);
free(targets);
hashmap__free(specs_hash);
if (elf)