Skip to contentSkip to conversation

net: Clear old fragment checksum value in napi_reuse_skb

PATCH Superseded Mohammad Heib 1 participant 1 message Feb 25, 2025

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 net: Clear old fragment checksum value in napi_reuse_skb

In certain cases, napi_get_frags() returns an skb that points to an old received fragment, This skb may have its skb->ip_summed, csum, and other fields set from previous fragment handling.

Some network drivers set skb->ip_summed to either CHECKSUM_COMPLETE or CHECKSUM_UNNECESSARY when getting skb from napi_get_frags(), while others only set skb->ip_summed when RX checksum offload is enabled on the device, and do not set any value for skb->ip_summed when hardware checksum offload is disabled, assuming that the skb->ip_summed initiated to zero by napi_reuse_skb.

This inconsistency sometimes leads to checksum validation issues in the upper layers of the network stack.

To resolve this, this patch clears the skb->ip_summed value for each reused skb in by napi_reuse_skb(), ensuring that the caller is responsible for setting the correct checksum status. This eliminates potential checksum validation issues caused by improper handling of skb->ip_summed.

Fixes 76620aafd66f ("gro: New frags interface to avoid copying shinfo")
---
 net/core/gro.c | 1 +
 1 file changed, 1 insertion(+)
net/core/gro.c +1 -0
index 78b320b63174..0ad549b07e03 100644
@@ -653,6 +653,7 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
 	skb->pkt_type = PACKET_HOST;
 
 	skb->encapsulation = 0;
+	skb->ip_summed = CHECKSUM_NONE;
 	skb_shinfo(skb)->gso_type = 0;
 	skb_shinfo(skb)->gso_size = 0;
 	if (unlikely(skb->slow_gro)) {
Signature · 1 line
2.48.1