]> www.infradead.org Git - users/dwmw2/linux.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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Oct 2018 23:59:22 +0000 (16:59 -0700)
commitefed642bc585c8d26bdba3b4de97d78057874bcf
tree223c5168f3b9b262da346c3bcdf29c5b764c76e0
parent0a9fd2a9875bd60afc0f8f9316e9ce63a1eb4e87
bpf, sockmap: fix sock_hash_alloc and reject zero-sized keys

[ Upstream commit b845c898b2f1ea458d5453f0fa1da6e2dfce3bb4 ]

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: 81110384441a ("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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/bpf/sockmap.c