netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: clear skb->sk in skb_release_head_state()
@ 2025-11-11 15:12 Eric Dumazet
  2025-11-12  5:23 ` Aditya Garg
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Eric Dumazet @ 2025-11-11 15:12 UTC (permalink / raw)
  To: David S . Miller, Jakub Kicinski, Paolo Abeni
  Cc: Simon Horman, Kuniyuki Iwashima, Willem de Bruijn, netdev,
	eric.dumazet, 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")
Signed-off-by: Eric Dumazet <edumazet@google.com>
---
 net/core/skbuff.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index 4f4d7ab7057f16bcf88f29827a45a9f4a8f43d5c..f34372666e67cee5329d3ba1d3c86f8622facac3 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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);
-- 
2.52.0.rc1.455.g30608eb744-goog


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: clear skb->sk in skb_release_head_state()
  2025-11-11 15:12 [PATCH net-next] net: clear skb->sk in skb_release_head_state() Eric Dumazet
@ 2025-11-12  5:23 ` Aditya Garg
  2025-11-12  5:54 ` Kuniyuki Iwashima
  2025-11-12 15:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Aditya Garg @ 2025-11-12  5:23 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Kuniyuki Iwashima, Willem de Bruijn, netdev, eric.dumazet,
	ssengar, gargaditya

On Tue, Nov 11, 2025 at 03:12:35PM +0000, Eric Dumazet 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().
> 
> Fixes: 1fcf572211da ("net: allow skb_release_head_state() to be called multiple times")
> Fixes: e20dfbad8aab ("net: fix napi_consume_skb() with alien skbs")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> ---
>  net/core/skbuff.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 4f4d7ab7057f16bcf88f29827a45a9f4a8f43d5c..f34372666e67cee5329d3ba1d3c86f8622facac3 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -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);
> -- 
> 2.52.0.rc1.455.g30608eb744-goog
>

Tested-by: Aditya Garg <gargaditya@linux.microsoft.com> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: clear skb->sk in skb_release_head_state()
  2025-11-11 15:12 [PATCH net-next] net: clear skb->sk in skb_release_head_state() Eric Dumazet
  2025-11-12  5:23 ` Aditya Garg
@ 2025-11-12  5:54 ` Kuniyuki Iwashima
  2025-11-12 15:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: Kuniyuki Iwashima @ 2025-11-12  5:54 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: David S . Miller, Jakub Kicinski, Paolo Abeni, Simon Horman,
	Willem de Bruijn, netdev, eric.dumazet

On Tue, Nov 11, 2025 at 7:12 AM Eric Dumazet <edumazet@google.com> 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().
>
> Fixes: 1fcf572211da ("net: allow skb_release_head_state() to be called multiple times")
> Fixes: e20dfbad8aab ("net: fix napi_consume_skb() with alien skbs")
> Signed-off-by: Eric Dumazet <edumazet@google.com>

Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH net-next] net: clear skb->sk in skb_release_head_state()
  2025-11-11 15:12 [PATCH net-next] net: clear skb->sk in skb_release_head_state() Eric Dumazet
  2025-11-12  5:23 ` Aditya Garg
  2025-11-12  5:54 ` Kuniyuki Iwashima
@ 2025-11-12 15:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-11-12 15:00 UTC (permalink / raw)
  To: Eric Dumazet
  Cc: davem, kuba, pabeni, horms, kuniyu, willemb, netdev, eric.dumazet

Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-11-12 15:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-11-11 15:12 [PATCH net-next] net: clear skb->sk in skb_release_head_state() Eric Dumazet
2025-11-12  5:23 ` Aditya Garg
2025-11-12  5:54 ` Kuniyuki Iwashima
2025-11-12 15:00 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).