Skip to content

Commit 55f3954

Browse files
committed
udp: expand SKB_DROP_REASON_UDP_CSUM use
JIRA: https://issues.redhat.com/browse/RHEL-88890 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 dd89fa3 commit 55f3954

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
@@ -1688,7 +1688,7 @@ static struct sk_buff *__first_packet_length(struct sock *sk,
16881688
atomic_inc(&sk->sk_drops);
16891689
__skb_unlink(skb, rcvq);
16901690
*total += skb->truesize;
1691-
kfree_skb(skb);
1691+
kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM);
16921692
} else {
16931693
udp_skb_csum_unnecessary_set(skb);
16941694
break;
@@ -1843,7 +1843,7 @@ int udp_read_skb(struct sock *sk, skb_read_actor_t recv_actor)
18431843
__UDP_INC_STATS(net, UDP_MIB_CSUMERRORS, is_udplite);
18441844
__UDP_INC_STATS(net, UDP_MIB_INERRORS, is_udplite);
18451845
atomic_inc(&sk->sk_drops);
1846-
kfree_skb(skb);
1846+
kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM);
18471847
goto try_again;
18481848
}
18491849

@@ -1957,7 +1957,7 @@ int udp_recvmsg(struct sock *sk, struct msghdr *msg, size_t len, int noblock,
19571957
UDP_INC_STATS(sock_net(sk), UDP_MIB_CSUMERRORS, is_udplite);
19581958
UDP_INC_STATS(sock_net(sk), UDP_MIB_INERRORS, is_udplite);
19591959
}
1960-
kfree_skb(skb);
1960+
kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM);
19611961

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

net/ipv6/udp.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -471,7 +471,7 @@ int udpv6_recvmsg(struct sock *sk, struct msghdr *msg, size_t len,
471471
SNMP_INC_STATS(mib, UDP_MIB_CSUMERRORS);
472472
SNMP_INC_STATS(mib, UDP_MIB_INERRORS);
473473
}
474-
kfree_skb(skb);
474+
kfree_skb_reason(skb, SKB_DROP_REASON_UDP_CSUM);
475475

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

0 commit comments

Comments
 (0)