Skip to content

Commit 6de1dec

Browse files
edumazetPaolo Abeni
authored andcommitted
udp: do not use skb_release_head_state() before skb_attempt_defer_free()
Michal reported and bisected an issue after recent adoption of skb_attempt_defer_free() in UDP. The issue here is that skb_release_head_state() is called twice per skb, one time from skb_consume_udp(), then a second time from skb_defer_free_flush() and napi_consume_skb(). As Sabrina suggested, remove skb_release_head_state() call from skb_consume_udp(). Add a DEBUG_NET_WARN_ON_ONCE(skb_nfct(skb)) in skb_attempt_defer_free() Many thanks to Michal, Sabrina, Paolo and Florian for their help. Fixes: 6471658 ("udp: use skb_attempt_defer_free()") Reported-and-bisected-by: Michal Kubecek <[email protected]> Closes: https://lore.kernel.org/netdev/gpjh4lrotyephiqpuldtxxizrsg6job7cvhiqrw72saz2ubs3h@g6fgbvexgl3r/ Signed-off-by: Eric Dumazet <[email protected]> Tested-by: Michal Kubecek <[email protected]> Cc: Sabrina Dubroca <[email protected]> Cc: Florian Westphal <[email protected]> Reviewed-by: Sabrina Dubroca <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
1 parent 8d93ff4 commit 6de1dec

File tree

2 files changed

+1
-2
lines changed

2 files changed

+1
-2
lines changed

net/core/skbuff.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7200,6 +7200,7 @@ nodefer: kfree_skb_napi_cache(skb);
72007200

72017201
DEBUG_NET_WARN_ON_ONCE(skb_dst(skb));
72027202
DEBUG_NET_WARN_ON_ONCE(skb->destructor);
7203+
DEBUG_NET_WARN_ON_ONCE(skb_nfct(skb));
72037204

72047205
sdn = per_cpu_ptr(net_hotdata.skb_defer_nodes, cpu) + numa_node_id();
72057206

net/ipv4/udp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1851,8 +1851,6 @@ void skb_consume_udp(struct sock *sk, struct sk_buff *skb, int len)
18511851
sk_peek_offset_bwd(sk, len);
18521852

18531853
if (!skb_shared(skb)) {
1854-
if (unlikely(udp_skb_has_head_state(skb)))
1855-
skb_release_head_state(skb);
18561854
skb_attempt_defer_free(skb);
18571855
return;
18581856
}

0 commit comments

Comments
 (0)