]> git.baikalelectronics.ru Git - kernel.git/commit
bpf, sockmap: fix sock hash count in alloc_sock_hash_elem
authorDaniel Borkmann <daniel@iogearbox.net>
Wed, 22 Aug 2018 16:09:17 +0000 (18:09 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 22 Aug 2018 18:35:18 +0000 (20:35 +0200)
commit914a7915d05ddc3c86af730e6a7f1a3370d152dc
tree8226d9ef2befb79ae7f8857ba6b8e2d1504f6cdf
parentb0da129a6e3162d0d5fb1f57c9829768630e6fbf
bpf, sockmap: fix sock hash count in alloc_sock_hash_elem

When we try to allocate a new sock hash entry and the allocation
fails, then sock hash map fails to reduce the map element counter,
meaning we keep accounting this element although it was never used.
Fix it by dropping the element counter on error.

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