* [PATCH net] tcp: fix TIME_WAIT socket reference leak on PSP policy failure
@ 2026-07-10 18:13 Eric Dumazet
2026-07-10 18:49 ` Kuniyuki Iwashima
2026-07-10 20:42 ` Daniel Zahka
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2026-07-10 18:13 UTC (permalink / raw)
To: David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, Daniel Zahka,
Willem de Bruijn, netdev, eric.dumazet, Eric Dumazet
Release the TIME_WAIT socket reference and jump to discard_it
upon PSP policy failure in both IPv4 and IPv6 receive paths.
This prevents a memory leak of tcp_tw_bucket structures.
Fixes: 659a2899a57d ("tcp: add datapath logic for PSP with inline key exchange")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
net/ipv4/tcp_ipv4.c | 6 ++++--
net/ipv6/tcp_ipv6.c | 6 ++++--
2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/net/ipv4/tcp_ipv4.c b/net/ipv4/tcp_ipv4.c
index 209ef7522508fcc3974ae71d35dd66cba96b73d0..4a46da375043be26bcbb282a0b0c3ba85bfc5186 100644
--- a/net/ipv4/tcp_ipv4.c
+++ b/net/ipv4/tcp_ipv4.c
@@ -2318,8 +2318,10 @@ int tcp_v4_rcv(struct sk_buff *skb)
}
drop_reason = psp_twsk_rx_policy_check(inet_twsk(sk), skb);
- if (drop_reason)
- break;
+ if (drop_reason) {
+ inet_twsk_put(inet_twsk(sk));
+ goto discard_it;
+ }
}
/* to ACK */
fallthrough;
diff --git a/net/ipv6/tcp_ipv6.c b/net/ipv6/tcp_ipv6.c
index ebe161d72fbd07a13d92812b45b5a3ce2464a015..522ba45ce9b759a6a76fd8603400097bc99c60c6 100644
--- a/net/ipv6/tcp_ipv6.c
+++ b/net/ipv6/tcp_ipv6.c
@@ -1977,8 +1977,10 @@ INDIRECT_CALLABLE_SCOPE int tcp_v6_rcv(struct sk_buff *skb)
}
drop_reason = psp_twsk_rx_policy_check(inet_twsk(sk), skb);
- if (drop_reason)
- break;
+ if (drop_reason) {
+ inet_twsk_put(inet_twsk(sk));
+ goto discard_it;
+ }
}
/* to ACK */
fallthrough;
--
2.55.0.795.g602f6c329a-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH net] tcp: fix TIME_WAIT socket reference leak on PSP policy failure
2026-07-10 18:13 [PATCH net] tcp: fix TIME_WAIT socket reference leak on PSP policy failure Eric Dumazet
@ 2026-07-10 18:49 ` Kuniyuki Iwashima
2026-07-10 20:42 ` Daniel Zahka
1 sibling, 0 replies; 3+ messages in thread
From: Kuniyuki Iwashima @ 2026-07-10 18:49 UTC (permalink / raw)
To: Eric Dumazet
Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
Neal Cardwell, Daniel Zahka, Willem de Bruijn, netdev,
eric.dumazet
On Fri, Jul 10, 2026 at 11:13 AM Eric Dumazet <edumazet@google.com> wrote:
>
> Release the TIME_WAIT socket reference and jump to discard_it
> upon PSP policy failure in both IPv4 and IPv6 receive paths.
> This prevents a memory leak of tcp_tw_bucket structures.
>
> Fixes: 659a2899a57d ("tcp: add datapath logic for PSP with inline key exchange")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH net] tcp: fix TIME_WAIT socket reference leak on PSP policy failure
2026-07-10 18:13 [PATCH net] tcp: fix TIME_WAIT socket reference leak on PSP policy failure Eric Dumazet
2026-07-10 18:49 ` Kuniyuki Iwashima
@ 2026-07-10 20:42 ` Daniel Zahka
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Zahka @ 2026-07-10 20:42 UTC (permalink / raw)
To: Eric Dumazet, David S . Miller, Jakub Kicinski, Paolo Abeni
Cc: Simon Horman, Neal Cardwell, Kuniyuki Iwashima, Willem de Bruijn,
netdev, eric.dumazet
On 7/10/26 2:13 PM, Eric Dumazet wrote:
> Release the TIME_WAIT socket reference and jump to discard_it
> upon PSP policy failure in both IPv4 and IPv6 receive paths.
> This prevents a memory leak of tcp_tw_bucket structures.
>
> Fixes: 659a2899a57d ("tcp: add datapath logic for PSP with inline key exchange")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Daniel Zahka <daniel.zahka@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-07-10 20:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-10 18:13 [PATCH net] tcp: fix TIME_WAIT socket reference leak on PSP policy failure Eric Dumazet
2026-07-10 18:49 ` Kuniyuki Iwashima
2026-07-10 20:42 ` Daniel Zahka
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox