bpf: Fix NULL pointer dereference in __btf_resolve_helper_id()
authorPeilin Ye <yepeilin.cs@gmail.com>
Tue, 14 Jul 2020 18:09:04 +0000 (14:09 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Aug 2020 13:35:34 +0000 (15:35 +0200)
commit06b46481d51fac58bb776067478ceeb460339a57
tree2869199304af3fdf5245ea0e52bd26f30a94af25
parent5cca11ebb504fe17de1a111b07317789fdab5da7
bpf: Fix NULL pointer dereference in __btf_resolve_helper_id()

[ Upstream commit 5b801dfb7feb2738975d80223efc2fc193e55573 ]

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: syzbot+ee09bda7017345f1fbe6@syzkaller.appspotmail.com
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20200714180904.277512-1-yepeilin.cs@gmail.com
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/bpf/btf.c