From: Gal Pressman <gal@nvidia.com>
To: Alice Mikityanska <alice.kernel@fastmail.im>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
netdev@vger.kernel.org
Cc: Simon Horman <horms@kernel.org>,
Dragos Tatulea <dtatulea@nvidia.com>,
Willem de Bruijn <willemb@google.com>,
Matthew Schwartz <matthew.schwartz@linux.dev>
Subject: Re: [PATCH net] udp: Fix UDP length on last GSO_PARTIAL segment
Date: Wed, 13 May 2026 12:43:16 +0300 [thread overview]
Message-ID: <f356add6-e173-4020-a8af-8cc70aec955d@nvidia.com> (raw)
In-Reply-To: <f75c1cf5-b5ad-47db-952f-faad9f0a33ed@app.fastmail.com>
On 13/05/2026 12:17, Alice Mikityanska wrote:
> On Wed, May 13, 2026, at 09:43, Gal Pressman wrote:
>> Following the cited commit, __udp_gso_segment() writes single MSS length
>> in the UDP header.
>> The cited patch doesn't account for the fact that the last segment could
>> be a GSO skb by itself. This could happen when the size of the packet is
>> a multiple of MSS, hence the first segment is also the last one (there
>> is no need for a remainder skb).
>>
>> When the post-loop segment is a GSO skb, assign the single MSS length in
>> the UDP header.
>>
>> Fixes: b10b446ce7ad ("udp: gso: Use single MSS length in UDP header for
>> GSO_PARTIAL")
>> Reported-by: Matthew Schwartz <matthew.schwartz@linux.dev>
>> Closes:
>> https://lore.kernel.org/all/6c3fb15e-711d-4b8d-b152-e03d9b05293f@linux.dev/
>> Tested-by: Matthew Schwartz <matthew.schwartz@linux.dev>
>> Reviewed-by: Dragos Tatulea <dtatulea@nvidia.com>
>> Signed-off-by: Gal Pressman <gal@nvidia.com>
>> ---
>> net/ipv4/udp_offload.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
>> index a0813d425b71..71df45f9488a 100644
>> --- a/net/ipv4/udp_offload.c
>> +++ b/net/ipv4/udp_offload.c
>> @@ -604,7 +604,7 @@ struct sk_buff *__udp_gso_segment(struct sk_buff *gso_skb,
>> seg->data_len);
>> check = csum16_add(csum16_sub(uh->check, uh->len), newlen);
>>
>> - uh->len = newlen;
>> + uh->len = skb_is_gso(seg) ? msslen : newlen;
>> uh->check = check;
>
> This is going to have the same checksum bug as your first commit, which
> I'm fixing in [1]. You should use the right value of either msslen or
> newlen when modifying check a couple of lines above.
I tend to agree that the checksum seems to have the wrong value, the
reason I chose not to change it is because my work only moved the UDP
length assignment from the drivers to the stack.
The "wrong" checksum value was used regardless of my change, and I
prefer not to change it as part of this work.
>
> That said, maybe you can base your patch on top of my checksum fix? For
> the last packet, it will then be:
>
> if (!skb_is_gso(seg))
> newlen = /* the new value */;
> /* keep newlen as is otherwise: my newlen is your msslen */
> check = csum16_add(csum16_sub(uh->check, uh->len), newlen);
> uh->len = newlen;
> uh->check = check;
>
> [1]: https://lore.kernel.org/netdev/20260512165648.386518-3-alice.kernel@fastmail.im/
As I mentioned in the other thread, this fix goes to net, I can't take
your patch.
next prev parent reply other threads:[~2026-05-13 9:43 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-13 7:43 [PATCH net] udp: Fix UDP length on last GSO_PARTIAL segment Gal Pressman
2026-05-13 9:17 ` Alice Mikityanska
2026-05-13 9:43 ` Gal Pressman [this message]
2026-05-13 10:08 ` Alice Mikityanska
2026-05-13 11:28 ` Gal Pressman
2026-05-13 11:48 ` Alice Mikityanska
2026-05-13 12:01 ` Gal Pressman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=f356add6-e173-4020-a8af-8cc70aec955d@nvidia.com \
--to=gal@nvidia.com \
--cc=alice.kernel@fastmail.im \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=dtatulea@nvidia.com \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=matthew.schwartz@linux.dev \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=willemb@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox