]> git.baikalelectronics.ru Git - kernel.git/commit
sock: redo the psock vs ULP protection check
authorJakub Kicinski <kuba@kernel.org>
Mon, 20 Jun 2022 19:13:53 +0000 (12:13 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Thu, 23 Jun 2022 08:08:30 +0000 (10:08 +0200)
commite30b0f7862733f74383db78935b5b17e1f7c1c80
treee35d546617ccabf2a0fb04953d347b0d8d6dd1aa
parent81b18f3fbbe368a45a3c8b9f14ed296ea647ccef
sock: redo the psock vs ULP protection check

Commit df7c8df97eba ("sock: Introduce sk->sk_prot->psock_update_sk_prot()")
has moved the inet_csk_has_ulp(sk) check from sk_psock_init() to
the new tcp_bpf_update_proto() function. I'm guessing that this
was done to allow creating psocks for non-inet sockets.

Unfortunately the destruction path for psock includes the ULP
unwind, so we need to fail the sk_psock_init() itself.
Otherwise if ULP is already present we'll notice that later,
and call tcp_update_ulp() with the sk_proto of the ULP
itself, which will most likely result in the ULP looping
its callbacks.

Fixes: df7c8df97eba ("sock: Introduce sk->sk_prot->psock_update_sk_prot()")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Reviewed-by: John Fastabend <john.fastabend@gmail.com>
Reviewed-by: Jakub Sitnicki <jakub@cloudflare.com>
Tested-by: Jakub Sitnicki <jakub@cloudflare.com>
Link: https://lore.kernel.org/r/20220620191353.1184629-2-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
include/net/inet_sock.h
net/core/skmsg.c
net/ipv4/tcp_bpf.c
net/tls/tls_main.c