tcp: fix TIME_WAIT socket reference leak on PSP policy failure
Subsystems (3)
PATCH 1/1 tcp: fix TIME_WAIT socket reference leak on PSP policy failure
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.
--- net/ipv4/tcp_ipv4.c | 6 ++++-- net/ipv6/tcp_ipv6.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
net/ipv4/tcp_ipv4.c +4 -2
@@ -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;
net/ipv6/tcp_ipv6.c +4 -2
@@ -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;
Signature · 1 line
2.55.0.795.g602f6c329a-goog
Quoted 7 lines · Eric Dumazet
Release the
TIME_WAITsocket reference and jump todiscard_itupon PSP policy failure in both IPv4 and IPv6 receive paths. This prevents a memory leak oftcp_tw_bucketstructures.Fixes 659a2899a57d ("tcp: add datapath logic for PSP with inline key exchange")Signed-off-by Eric Dumazet <[email protected]>
Quoted 6 lines · Eric Dumazet
Release the
TIME_WAITsocket reference and jump todiscard_itupon PSP policy failure in both IPv4 and IPv6 receive paths. This prevents a memory leak oftcp_tw_bucketstructures.Fixes 659a2899a57d ("tcp: add datapath logic for PSP with inline key exchange")Signed-off-by Eric Dumazet <[email protected]>
This patch was applied to netdev/net.git (main) by Paolo Abeni <[email protected]>:
Hello:
This patch was applied to netdev/net.git (main)
by Paolo Abeni <[email protected]>:
Quoted 8 lines · On Fri, 10 Jul 2026 18:13:17 +0000 you wrote:
Release the
TIME_WAITsocket reference and jump todiscard_itupon PSP policy failure in both IPv4 and IPv6 receive paths. This prevents a memory leak oftcp_tw_bucketstructures.Fixes 659a2899a57d ("tcp: add datapath logic for PSP with inline key exchange")Signed-off-by Eric Dumazet <[email protected]>[...]
Here is the summary with links:
- [net] tcp: fix TIME_WAIT socket reference leak on PSP policy failure
https://git.kernel.org/netdev/net/c/2c1931a81122
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html