Skip to contentSkip to conversation

udp: call skb_orphan() before skb_attempt_defer_free()

PATCH Applied Eric Dumazet 2 participants 2 messages Jan 5 – Jan 7

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

PATCH 1/1 udp: call skb_orphan() before skb_attempt_defer_free()

Standard UDP receive path does not use skb->destructor.

But skmsg layer does use it, since it calls skb_set_owner_sk_safe() from udp_read_skb().

This then triggers this warning in skb_attempt_defer_free():

    DEBUG_NET_WARN_ON_ONCE(skb->destructor);

We must call skb_orphan() to fix this issue.

Fixes 6471658dc66c ("udp: use skb_attempt_defer_free()")
Reported-by [email protected]
---
 net/ipv4/udp.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/udp.c +1 -0
index ffe074cb5865..ee63af0ef42c 100644
@@ -1851,6 +1851,7 @@ void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len)
 		sk_peek_offset_bwd(sk, len);
 
 	if (!skb_shared(skb)) {
+		skb_orphan(skb);
 		skb_attempt_defer_free(skb);
 		return;
 	}
Signature · 1 line
2.52.0.351.gbe84eed79e-goog
#1 lore raw
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

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

Quoted 8 lines · On Mon, 5 Jan 2026 09:36:30 +0000 you wrote:

Standard UDP receive path does not use skb->destructor.

But skmsg layer does use it, since it calls skb_set_owner_sk_safe() from udp_read_skb().

This then triggers this warning in skb_attempt_defer_free():

[...]

Here is the summary with links:
- [net] udp: call skb_orphan() before skb_attempt_defer_free()

    https://git.kernel.org/netdev/net/c/e5c8eda39a9f

You are awesome, thank you!

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