From: Vladimir Oltean <vladimir.oltean@nxp.com>
To: Eric Dumazet <eric.dumazet@gmail.com>
Cc: "David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>, netdev <netdev@vger.kernel.org>,
Eric Dumazet <edumazet@google.com>,
David Laight <David.Laight@ACULAB.COM>,
David Lebrun <dlebrun@google.com>
Subject: Re: [PATCH v2 net-next] net: fix recent csum changes
Date: Sat, 4 Dec 2021 12:57:08 +0000 [thread overview]
Message-ID: <20211204125707.tn2w2uqlphqq23l6@skbuf> (raw)
In-Reply-To: <20211204045356.3659278-1-eric.dumazet@gmail.com>
On Fri, Dec 03, 2021 at 08:53:56PM -0800, Eric Dumazet wrote:
> From: Eric Dumazet <edumazet@google.com>
>
> Vladimir reported csum issues after my recent change in skb_postpull_rcsum()
>
> Issue here is the following:
>
> initial skb->csum is the csum of
>
> [part to be pulled][rest of packet]
>
> Old code:
> skb->csum = csum_sub(skb->csum, csum_partial(pull, pull_length, 0));
>
> New code:
> skb->csum = ~csum_partial(pull, pull_length, ~skb->csum);
>
> This is broken if the csum of [pulled part]
> happens to be equal to skb->csum, because end
> result of skb->csum is 0 in new code, instead
> of being 0xffffffff
>
> David Laight suggested to use
>
> skb->csum = -csum_partial(pull, pull_length, -skb->csum);
>
> I based my patches on existing code present in include/net/seg6.h,
> update_csum_diff4() and update_csum_diff16() which might need
> a similar fix.
>
> I guess that my tests, mostly pulling 40 bytes of IPv6 header
> were not providing enough entropy to hit this bug.
>
> v2: added wsum_negate() to make sparse happy.
>
> Fixes: 29c3002644bd ("net: optimize skb_postpull_rcsum()")
> Fixes: 0bd28476f636 ("gro: optimize skb_gro_postpull_rcsum()")
> Signed-off-by: Eric Dumazet <edumazet@google.com>
> Reported-by: Vladimir Oltean <vladimir.oltean@nxp.com>
> Suggested-by: David Laight <David.Laight@ACULAB.COM>
> Cc: David Lebrun <dlebrun@google.com>
> ---
Tested-by: Vladimir Oltean <vladimir.oltean@nxp.com>
Thanks!
next prev parent reply other threads:[~2021-12-04 12:57 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-12-04 4:53 [PATCH v2 net-next] net: fix recent csum changes Eric Dumazet
2021-12-04 12:57 ` Vladimir Oltean [this message]
2021-12-07 0:40 ` patchwork-bot+netdevbpf
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=20211204125707.tn2w2uqlphqq23l6@skbuf \
--to=vladimir.oltean@nxp.com \
--cc=David.Laight@ACULAB.COM \
--cc=davem@davemloft.net \
--cc=dlebrun@google.com \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
/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