Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
[linux-2.6-microblaze.git] / net / bpf / test_run.c
index cda8375..b488e27 100644 (file)
@@ -761,6 +761,11 @@ int bpf_prog_test_run_xdp(struct bpf_prog *prog, const union bpf_attr *kattr,
        void *data;
        int ret = -EINVAL;
 
+       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;
        ctx = bpf_ctx_init(kattr, sizeof(struct xdp_md));
        if (IS_ERR(ctx))
                return PTR_ERR(ctx);