Skip to content

Commit e58c5c9

Browse files
Lotte-Baianakryiko
authored andcommitted
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: Haowen Bai <[email protected]> Signed-off-by: Andrii Nakryiko <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 502b0e3 commit e58c5c9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/lib/bpf/usdt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,8 +1071,8 @@ struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct
10711071
return &link->link;
10721072

10731073
err_out:
1074-
bpf_link__destroy(&link->link);
1075-
1074+
if (link)
1075+
bpf_link__destroy(&link->link);
10761076
free(targets);
10771077
hashmap__free(specs_hash);
10781078
if (elf)

0 commit comments

Comments
 (0)