diff mbox series

[net] udp: fix receiving fraglist GSO packets

Message ID 20240819150621.59833-1-nbd@nbd.name (mailing list archive)
State Accepted
Commit b128ed5ab27330deeeaf51ea8bb69f1442a96f7f
Delegated to: Netdev Maintainers
Headers show
Series [net] udp: fix receiving fraglist GSO packets | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag present in non-next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 6 of 6 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 21 this patch: 21
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-08-20--09-00 (tests: 712)

Commit Message

Felix Fietkau Aug. 19, 2024, 3:06 p.m. UTC
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")
Signed-off-by: Felix Fietkau <nbd@nbd.name>
---
 net/ipv4/udp_offload.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Willem de Bruijn Aug. 19, 2024, 7:53 p.m. UTC | #1
Felix Fietkau 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")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>

Reviewed-by: Willem de Bruijn <willemb@google.com>

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.
patchwork-bot+netdevbpf@kernel.org Aug. 22, 2024, 12:30 a.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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")
> Signed-off-by: Felix Fietkau <nbd@nbd.name>
> ---
>  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!
diff mbox series

Patch

diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
index b254a5dadfcf..d842303587af 100644
--- a/net/ipv4/udp_offload.c
+++ b/net/ipv4/udp_offload.c
@@ -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