summaryrefslogtreecommitdiffstats
path: root/net/core
diff options
context:
space:
mode:
authorLorenz Bauer <lmb@cloudflare.com>2020-06-29 10:56:27 +0100
committerAlexei Starovoitov <ast@kernel.org>2020-06-30 10:46:39 -0700
commit9b2b09717e1812e450782a43ca0c2790651cf380 (patch)
tree335fdf3b51260b4b2445c736b9ca24899b181bcd /net/core
parent4ac2add65974e4efafb8d4ccd8fc5660417ea312 (diff)
downloadlinux-9b2b09717e1812e450782a43ca0c2790651cf380.tar.gz
linux-9b2b09717e1812e450782a43ca0c2790651cf380.tar.bz2
linux-9b2b09717e1812e450782a43ca0c2790651cf380.zip
bpf: sockmap: Check value of unused args to BPF_PROG_ATTACH
Using BPF_PROG_ATTACH on a sockmap program currently understands no flags or replace_bpf_fd, but accepts any value. Return EINVAL instead. Fixes: 604326b41a6f ("bpf, sockmap: convert to generic sk_msg interface") Signed-off-by: Lorenz Bauer <lmb@cloudflare.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20200629095630.7933-4-lmb@cloudflare.com
Diffstat (limited to 'net/core')
-rw-r--r--net/core/sock_map.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/net/core/sock_map.c b/net/core/sock_map.c
index 4059f94e9bb5..58016a5c63ff 100644
--- a/net/core/sock_map.c
+++ b/net/core/sock_map.c
@@ -70,6 +70,9 @@ int sock_map_get_from_fd(const union bpf_attr *attr, struct bpf_prog *prog)
struct fd f;
int ret;
+ if (attr->attach_flags || attr->replace_bpf_fd)
+ return -EINVAL;
+
f = fdget(ufd);
map = __bpf_map_get(f);
if (IS_ERR(map))