[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CANn89i+gMUzYfX2UTzCZx_S=96UHEf9_KzkG-cCq9aQkUiX3Bg@mail.gmail.com>
Date: Fri, 26 Jul 2024 09:00:30 +0200
From: Eric Dumazet <edumazet@...gle.com>
To: Willem de Bruijn <willemdebruijn.kernel@...il.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, mst@...hat.com, jasowang@...hat.com, arefev@...mel.ru,
alexander.duyck@...il.com, Willem de Bruijn <willemb@...gle.com>, stable@...r.kernel.org
Subject: Re: [PATCH net] net: drop bad gso csum_start and offset in virtio_net_hdr
On Fri, Jul 26, 2024 at 4:34 AM Willem de Bruijn
<willemdebruijn.kernel@...il.com> wrote:
>
> From: Willem de Bruijn <willemb@...gle.com>
...
> /* 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())
Powered by blists - more mailing lists