]> git.baikalelectronics.ru Git - kernel.git/commit
bpf: Fix use of sk->sk_reuseport from sk_assign
authorJoe Stringer <joe@wand.net.nz>
Wed, 8 Apr 2020 03:35:40 +0000 (20:35 -0700)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 8 Apr 2020 23:02:14 +0000 (01:02 +0200)
commit8a99387ae8d09422aa716477ff0a016c9d9e3df0
tree654cd7e341b07cb25b2a1b224d7c900f26ebce91
parent970d87eab7546cb9d67447529222b0fbed243540
bpf: Fix use of sk->sk_reuseport from sk_assign

In testing, we found that for request sockets the sk->sk_reuseport field
may yet be uninitialized, which caused bpf_sk_assign() to randomly
succeed or return -ESOCKTNOSUPPORT when handling the forward ACK in a
three-way handshake.

Fix it by only applying the reuseport check for full sockets.

Fixes: 7f639bf869c8 ("bpf: Add socket assign support")
Signed-off-by: Joe Stringer <joe@wand.net.nz>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Acked-by: Martin KaFai Lau <kafai@fb.com>
Link: https://lore.kernel.org/bpf/20200408033540.10339-1-joe@wand.net.nz
net/core/filter.c