Skip to content

Commit 5b801df

Browse files
peilin-yeborkmann
authored andcommitted
bpf: Fix NULL pointer dereference in __btf_resolve_helper_id()
Prevent __btf_resolve_helper_id() from dereferencing `btf_vmlinux` as NULL. This patch fixes the following syzbot bug: https://syzkaller.appspot.com/bug?id=f823224ada908fa5c207902a5a62065e53ca0fcc Reported-by: [email protected] Signed-off-by: Peilin Ye <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 55b2442 commit 5b801df

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

kernel/bpf/btf.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4058,6 +4058,11 @@ static int __btf_resolve_helper_id(struct bpf_verifier_log *log, void *fn,
40584058
const char *tname, *sym;
40594059
u32 btf_id, i;
40604060

4061+
if (!btf_vmlinux) {
4062+
bpf_log(log, "btf_vmlinux doesn't exist\n");
4063+
return -EINVAL;
4064+
}
4065+
40614066
if (IS_ERR(btf_vmlinux)) {
40624067
bpf_log(log, "btf_vmlinux is malformed\n");
40634068
return -EINVAL;

0 commit comments

Comments
 (0)