Skip to content

Commit db64ebe

Browse files
committed
udp: expand SKB_DROP_REASON_UDP_CSUM use
JIRA: https://issues.redhat.com/browse/RHEL-88891 Upstream Status: linux.git commit b3aaf3c Author: Eric Dumazet <edumazet@google.com> Date: Fri Mar 7 10:20:02 2025 +0000 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> Signed-off-by: Antoine Tenart <atenart@redhat.com>
1 parent 2e0deaa commit db64ebe

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

net/ipv4/udp.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,7 +1699,7 @@ static struct sk_buff *__first_packet_length(struct sock *sk,
16991699
atomic_inc(&sk->sk_drops);
17001700
__skb_unlink(skb, rcvq);
17011701
*total += skb->truesize;
1702-
kfree_skb(skb);
1702+
kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM);
17031703
} else {
17041704
udp_skb_csum_unnecessary_set(skb);
17051705
break;
@@ -1853,7 +1853,7 @@ int udp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
18531853
__UDP_INC_STATS(net, UDP_MIB_CSUMERRORS, is_udplite);
18541854
__UDP_INC_STATS(net, UDP_MIB_INERRORS, is_udplite);
18551855
atomic_inc(&sk->sk_drops);
1856-
kfree_skb(skb);
1856+
kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM);
18571857
goto try_again;
18581858
}
18591859

@@ -1968,7 +1968,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int flags,
19681968
UDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite);
19691969
UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
19701970
}
1971-
kfree_skb(skb);
1971+
kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM);
19721972

19731973
/* starting over for a new packet, but check if we need to yield */
19741974
cond_resched();

net/ipv6/udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -502,7 +502,7 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
502502
SNMP_INC_STATS(mib, UDP_MIB_CSUMERRORS);
503503
SNMP_INC_STATS(mib, UDP_MIB_INERRORS);
504504
}
505-
kfree_skb(skb);
505+
kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM);
506506

507507
/* starting over for a new packet, but check if we need to yield */
508508
cond_resched();

0 commit comments

Comments
 (0)