* [PATCH bpf] bpf, sockmap: Don't replace a ULP's sk_prot when leaving a sockmap
@ 2026-11-30 5:56 Sechang Lim
0 siblings, 0 replies; only message in thread
From: Sechang Lim @ 2026-11-30 5:56 UTC (permalink / raw)
To: bpf
Cc: netdev, edumazet, ncardwell, kuniyu, john.fastabend, jakub,
jiayuan.chen, davem, kuba, pabeni, horms
A socket can get the TLS ULP after it was added to a sockmap. If the
map has an sk_skb program, removing the socket from it calls
tcp_bpf_update_proto() with restore=false, which puts a tcp_bpf proto
in sk->sk_prot over the TLS one.
When the psock is dropped, the restore path sees the ULP and only calls
tcp_update_ulp(), which updates the TLS context but leaves sk->sk_prot
alone. close() then enters sock_map_close() with no psock, reads
sock_map_close() again from sk->sk_prot->close and retries forever. The
task can't be killed and the socket is never freed.
Don't replace sk->sk_prot when a ULP is installed.
Fixes: e34a07c0ae39 ("sock: redo the psock vs ULP protection check")
Signed-off-by: Sechang Lim <rhkrqnwk98@gmail.com>
---
net/ipv4/tcp_bpf.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/ipv4/tcp_bpf.c b/net/ipv4/tcp_bpf.c
index 788ce08eef4d..035894e5d923 100644
--- a/net/ipv4/tcp_bpf.c
+++ b/net/ipv4/tcp_bpf.c
@@ -810,6 +810,9 @@ int tcp_bpf_update_proto(struct sock *sk, struct sk_psock *psock, bool restore)
return 0;
}
+ if (inet_csk_has_ulp(sk))
+ return -EINVAL;
+
if (sk->sk_family == AF_INET6) {
if (tcp_bpf_assert_proto_ops(psock->sk_proto))
return -EINVAL;
--
2.56.1
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-30 5:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 5:56 [PATCH bpf] bpf, sockmap: Don't replace a ULP's sk_prot when leaving a sockmap Sechang Lim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox