Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

udp: expand SKB_DROP_REASON_UDP_CSUM use

SKB_DROP_REASON_UDP_CSUM can be used in four locations
when dropping a packet because of a wrong UDP checksum.

Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Link: https://patch.msgid.link/20250307102002.2095238-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Eric Dumazet and committed by
Jakub Kicinski
b3aaf3c1 248f6571

+4 -4
+3 -3
net/ipv4/udp.c
··· 1848 1848 atomic_inc(&sk->sk_drops); 1849 1849 __skb_unlink(skb, rcvq); 1850 1850 *total += skb->truesize; 1851 - kfree_skb(skb); 1851 + kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM); 1852 1852 } else { 1853 1853 udp_skb_csum_unnecessary_set(skb); 1854 1854 break; ··· 2002 2002 __UDP_INC_STATS(net, UDP_MIB_CSUMERRORS, is_udplite); 2003 2003 __UDP_INC_STATS(net, UDP_MIB_INERRORS, is_udplite); 2004 2004 atomic_inc(&sk->sk_drops); 2005 - kfree_skb(skb); 2005 + kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM); 2006 2006 goto try_again; 2007 2007 } 2008 2008 ··· 2117 2117 UDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite); 2118 2118 UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite); 2119 2119 } 2120 - kfree_skb(skb); 2120 + kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM); 2121 2121 2122 2122 /* starting over for a new packet, but check if we need to yield */ 2123 2123 cond_resched();
+1 -1
net/ipv6/udp.c
··· 586 586 SNMP_INC_STATS(mib, UDP_MIB_CSUMERRORS); 587 587 SNMP_INC_STATS(mib, UDP_MIB_INERRORS); 588 588 } 589 - kfree_skb(skb); 589 + kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM); 590 590 591 591 /* starting over for a new packet, but check if we need to yield */ 592 592 cond_resched();