Thread (26 messages) 26 messages, 9 authors, 2024-08-27

Re: [PATCH net] net: drop bad gso csum_start and offset in virtio_net_hdr

From: Eric Dumazet <edumazet@google.com>
Date: 2024-07-26 07:00:46
Also in: stable

On Fri, Jul 26, 2024 at 4:34 AM Willem de Bruijn
[off-list ref] wrote:
From: Willem de Bruijn <willemb@google.com>
...
quoted hunk ↗ jump to hunk
                /* Kernel has a special handling for GSO_BY_FRAGS. */
diff --git a/net/ipv4/tcp_offload.c b/net/ipv4/tcp_offload.c
index 4b791e74529e1..9e49ffcc77071 100644
--- a/net/ipv4/tcp_offload.c
+++ b/net/ipv4/tcp_offload.c
@@ -140,6 +140,9 @@ struct sk_buff *tcp_gso_segment(struct sk_buff *skb,
        if (thlen < sizeof(*th))
                goto out;

+       if (unlikely(skb->csum_start != skb->transport_header))
+               goto out;
+
Using skb_transport_header() will make sure DEBUG_NET_WARN_ON_ONCE()
will fire for debug kernels,
with no additional costs for non debug kernels (compiler will generate
not use skb->head at all)

if (unlikely(skb->csum_start != skb_transport_header(skb) - skb->head))
                  goto out;

(This will match the corresponding initialization in __tcp_v4_send_check())
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help