diff options
Diffstat (limited to 'kernel/bpf/syscall.c')
-rw-r--r-- | kernel/bpf/syscall.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/bpf/syscall.c b/kernel/bpf/syscall.c index 438199e2eca4..d995eedfdd16 100644 --- a/kernel/bpf/syscall.c +++ b/kernel/bpf/syscall.c | |||
@@ -2009,7 +2009,7 @@ static int bpf_prog_query(const union bpf_attr *attr, | |||
2009 | return cgroup_bpf_prog_query(attr, uattr); | 2009 | return cgroup_bpf_prog_query(attr, uattr); |
2010 | } | 2010 | } |
2011 | 2011 | ||
2012 | #define BPF_PROG_TEST_RUN_LAST_FIELD test.duration | 2012 | #define BPF_PROG_TEST_RUN_LAST_FIELD test.ctx_out |
2013 | 2013 | ||
2014 | static int bpf_prog_test_run(const union bpf_attr *attr, | 2014 | static int bpf_prog_test_run(const union bpf_attr *attr, |
2015 | union bpf_attr __user *uattr) | 2015 | union bpf_attr __user *uattr) |
@@ -2022,6 +2022,14 @@ static int bpf_prog_test_run(const union bpf_attr *attr, | |||
2022 | if (CHECK_ATTR(BPF_PROG_TEST_RUN)) | 2022 | if (CHECK_ATTR(BPF_PROG_TEST_RUN)) |
2023 | return -EINVAL; | 2023 | return -EINVAL; |
2024 | 2024 | ||
2025 | if ((attr->test.ctx_size_in && !attr->test.ctx_in) || | ||
2026 | (!attr->test.ctx_size_in && attr->test.ctx_in)) | ||
2027 | return -EINVAL; | ||
2028 | |||
2029 | if ((attr->test.ctx_size_out && !attr->test.ctx_out) || | ||
2030 | (!attr->test.ctx_size_out && attr->test.ctx_out)) | ||
2031 | return -EINVAL; | ||
2032 | |||
2025 | prog = bpf_prog_get(attr->test.prog_fd); | 2033 | prog = bpf_prog_get(attr->test.prog_fd); |
2026 | if (IS_ERR(prog)) | 2034 | if (IS_ERR(prog)) |
2027 | return PTR_ERR(prog); | 2035 | return PTR_ERR(prog); |