diff --git a/net/bpf/test_run.c b/net/bpf/test_run.c index 8b796c499cbb2..e7cbd1b4a5e51 100644 --- a/net/bpf/test_run.c +++ b/net/bpf/test_run.c @@ -627,6 +627,9 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr, void *data; int ret; + if (prog->expected_attach_type == BPF_XDP_DEVMAP || + prog->expected_attach_type == BPF_XDP_CPUMAP) + return -EINVAL; if (kattr->test.ctx_in || kattr->test.ctx_out) return -EINVAL;