]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Don't refcount LISTEN sockets in sk_assign()
authorJoe Stringer <joe@wand.net.nz>
Sun, 29 Mar 2020 22:53:40 +0000 (15:53 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Mon, 30 Mar 2020 20:45:05 +0000 (13:45 -0700)
commit005da6354799681ecdfcc024819a192266ffb5fd
treebc88bf441433f5bf7a3d66610adb5d1ad1707390
parentc458c25e0430eb9108cd5a52a00792b2db3df3c4
bpf: Don't refcount LISTEN sockets in sk_assign()

Avoid taking a reference on listen sockets by checking the socket type
in the sk_assign and in the corresponding skb_steal_sock() code in the
the transport layer, and by ensuring that the prefetch free (sock_pfree)
function uses the same logic to check whether the socket is refcounted.

Suggested-by: Martin KaFai Lau <kafai@fb.com>
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200329225342.16317-4-joe@wand.net.nz
include/net/sock.h
net/core/filter.c
net/core/sock.c