Skip to contentSkip to conversation

net: clear skb->sk in skb_release_head_state()

PATCH Applied Eric Dumazet 4 participants 4 messages Nov 11, 2025 – Nov 12, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: clear skb->sk in skb_release_head_state()

skb_release_head_state() inlines skb_orphan().

We need to clear skb->sk otherwise we can freeze TCP flows on a mostly idle host, because skb_fclone_busy() would return true as long as the packet is not yet processed by skb_defer_free_flush().

Fixes 1fcf572211da ("net: allow skb_release_head_state() to be called multiple times")
Fixes e20dfbad8aab ("net: fix napi_consume_skb() with alien skbs")
---
 net/core/skbuff.c | 1 +
 1 file changed, 1 insertion(+)
net/core/skbuff.c +1 -0
index 4f4d7ab7057f16bcf88f29827a45a9f4a8f43d5c..f34372666e67cee5329d3ba1d3c86f8622facac3 100644
@@ -1152,6 +1152,7 @@ void skb_release_head_state(struct sk_buff *skb)
 
 #endif
 		skb->destructor = NULL;
+		skb->sk = NULL;
 	}
 	nf_reset_ct(skb);
 	skb_ext_reset(skb);
Signature · 1 line
2.52.0.rc1.455.g30608eb744-goog
Tested-by on v1 1/1
#1 lore raw
Quoted 29 lines · Eric Dumazet

skb_release_head_state() inlines skb_orphan().

We need to clear skb->sk otherwise we can freeze TCP flows on a mostly idle host, because skb_fclone_busy() would return true as long as the packet is not yet processed by skb_defer_free_flush().

Fixes 1fcf572211da ("net: allow skb_release_head_state() to be called multiple times")
Fixes e20dfbad8aab ("net: fix napi_consume_skb() with alien skbs")
---
 net/core/skbuff.c | 1 +
 1 file changed, 1 insertion(+)
net/core/skbuff.c +1 -0
index 4f4d7ab7057f16bcf88f29827a45a9f4a8f43d5c..f34372666e67cee5329d3ba1d3c86f8622facac3 100644
@@ -1152,6 +1152,7 @@ void skb_release_head_state(struct sk_buff *skb)
 
 #endif
 		skb->destructor = NULL;
+		skb->sk = NULL;
 	}
 	nf_reset_ct(skb);
 	skb_ext_reset(skb);
Signature · 1 line
2.52.0.rc1.455.g30608eb744-goog
Reviewed-by on v1 1/1
#2 lore raw
In reply to Eric Dumazet
Quoted 11 lines · Eric Dumazet

skb_release_head_state() inlines skb_orphan().

We need to clear skb->sk otherwise we can freeze TCP flows on a mostly idle host, because skb_fclone_busy() would return true as long as the packet is not yet processed by skb_defer_free_flush().

Fixes 1fcf572211da ("net: allow skb_release_head_state() to be called multiple times")
Fixes e20dfbad8aab ("net: fix napi_consume_skb() with alien skbs")
#3 lore raw
In reply to Eric Dumazet
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Tue, 11 Nov 2025 15:12:35 +0000 you wrote:

skb_release_head_state() inlines skb_orphan().

We need to clear skb->sk otherwise we can freeze TCP flows on a mostly idle host, because skb_fclone_busy() would return true as long as the packet is not yet processed by skb_defer_free_flush().

[...]

Here is the summary with links:
- [net-next] net: clear skb->sk in skb_release_head_state()

    https://git.kernel.org/netdev/net-next/c/26b8986a18c1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html