Skip to content

Commit 4a15bc4

Browse files
Lotte-BaiKernel Patches Daemon
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]>
1 parent 16c5550 commit 4a15bc4

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
@@ -996,7 +996,7 @@ struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct
996996
link = calloc(1, sizeof(*link));
997997
if (!link) {
998998
err = -ENOMEM;
999-
goto err_out;
999+
goto link_err;
10001000
}
10011001

10021002
link->usdt_man = man;
@@ -1072,7 +1072,7 @@ struct bpf_link *usdt_manager_attach_usdt(struct usdt_manager *man, const struct
10721072

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

0 commit comments

Comments
 (0)