]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, sockmap: fix sock_hash_alloc and reject zero-sized keys
authorDaniel Borkmann <daniel@iogearbox.net>
Tue, 21 Aug 2018 13:55:00 +0000 (15:55 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 22 Aug 2018 18:34:51 +0000 (20:34 +0200)
commitb0da129a6e3162d0d5fb1f57c9829768630e6fbf
treed458693137c517ac84ff3195e1bb3e76019473b8
parent23ead4a3a10036a94a2f0359f6292ef5c1138e58
bpf, sockmap: fix sock_hash_alloc and reject zero-sized keys

Currently, it is possible to create a sock hash map with key size
of 0 and have the kernel return a fd back to user space. This is
invalid for hash maps (and kernel also hasn't been tested for zero
key size support in general at this point). Thus, reject such
configuration.

Fixes: 5cadb0760c3e ("bpf: sockmap, add hash map support")
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: John Fastabend <john.fastabend@gmail.com>
Acked-by: Song Liu <songliubraving@fb.com>
kernel/bpf/sockmap.c