netdevsim: Don't accept device bound programs
authorStanislav Fomichev <sdf@google.com>
Tue, 14 Nov 2023 04:54:52 +0000 (20:54 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 8 Dec 2023 07:52:21 +0000 (08:52 +0100)
commit41a0b3b8cfff6cc2827fe4b77dfea571a4128d43
tree5befece875aa6662079e8462f5492ea8ccc62428
parent2cc612b8ed89f3e80869a736b6551dd296875bdc
netdevsim: Don't accept device bound programs

[ Upstream commit c0c6bde586c7dce82719b4ff32a2db6af9ee3d65 ]

Commit 2b3486bc2d23 ("bpf: Introduce device-bound XDP programs") introduced
device-bound programs by largely reusing existing offloading infrastructure.
This changed the semantics of 'prog->aux->offload' a bit. Now, it's non-NULL
for both offloaded and device-bound programs.

Instead of looking at 'prog->aux->offload' let's call bpf_prog_is_offloaded
which should be true iff the program is offloaded and not merely device-bound.

Fixes: 2b3486bc2d23 ("bpf: Introduce device-bound XDP programs")
Reported-by: syzbot+44c2416196b7c607f226@syzkaller.appspotmail.com
Signed-off-by: Stanislav Fomichev <sdf@google.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Reviewed-by: Jakub Kicinski <kuba@kernel.org>
Cc: Dipendra Khadka <kdipendra88@gmail.com>
Link: https://lore.kernel.org/bpf/20231114045453.1816995-2-sdf@google.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/netdevsim/bpf.c