Skip to contentSkip to conversation

udp: fix receiving fraglist GSO packets

PATCH Applied Felix Fietkau 3 participants 3 messages Aug 19, 2024 – Aug 22, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 udp: fix receiving fraglist GSO packets

When assembling fraglist GSO packets, udp4_gro_complete does not set skb->csum_start, which makes the extra validation in __udp_gso_segment fail.

Fixes 89add40066f9 ("net: drop bad gso csum_start and offset in virtio_net_hdr")
---
 net/ipv4/udp_offload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
net/ipv4/udp_offload.c +2 -1
index b254a5dadfcf..d842303587af 100644
@@ -279,7 +279,8 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
 		return ERR_PTR(-EINVAL);
 
 	if (unlikely(skb_checksum_start(gso_skb) !=
-		     skb_transport_header(gso_skb)))
+		     skb_transport_header(gso_skb) &&
+		     !(skb_shinfo(gso_skb)->gso_type & SKB_GSO_FRAGLIST)))
 		return ERR_PTR(-EINVAL);
 
 	/* We don't know if egress device can segment and checksum the packet
Signature · 1 line
2.46.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Felix Fietkau

When assembling fraglist GSO packets, udp4_gro_complete does not set skb->csum_start, which makes the extra validation in __udp_gso_segment fail.

Fixes 89add40066f9 ("net: drop bad gso csum_start and offset in virtio_net_hdr")

Oh right, UDP GRO fraglist skbs are converted to CHECKSUM_UNNECSSARY with __skb_incr_checksum_unnecessary.

Rather than to CHECKSUM_PARTIAL, as udp_gro_complete_segment does for non fraglist GRO packets.

virtio_net_hdr_to_skb cannot generate fraglist packets, so this bad input check is unnecessary for SKB_GSO_FRAGLIST too.

Thanks for the fix, Felix.

#2 lore raw
In reply to Felix Fietkau
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 8 lines · On Mon, 19 Aug 2024 17:06:21 +0200 you wrote:

When assembling fraglist GSO packets, udp4_gro_complete does not set skb->csum_start, which makes the extra validation in __udp_gso_segment fail.

Fixes 89add40066f9 ("net: drop bad gso csum_start and offset in virtio_net_hdr")
---
 net/ipv4/udp_offload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Here is the summary with links:
- [net] udp: fix receiving fraglist GSO packets

    https://git.kernel.org/netdev/net/c/b128ed5ab273

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html