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())