linux-stable/include
Eric Dumazet 45cac67545 net: fix recent csum changes
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: 29c3002644 ("net: optimize skb_postpull_rcsum()")
Fixes: 0bd28476f6 ("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>
Link: https://lore.kernel.org/r/20211204045356.3659278-1-eric.dumazet@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2021-12-06 16:26:46 -08:00
..
acpi Merge branches 'acpica', 'acpi-ec', 'acpi-pmic' and 'acpi-video' 2021-11-10 14:03:14 +01:00
asm-generic Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-11-26 13:45:19 -08:00
clocksource
crypto
drm Removed the TTM Huge Page functionnality to address a crash, a timeout 2021-11-11 08:14:19 +10:00
dt-bindings dt-bindings: Rename Ingenic CGU headers to ingenic,*.h 2021-11-11 22:27:14 -06:00
keys
kunit include/kunit/test.h: replace kernel.h with the necessary inclusions 2021-11-09 10:02:49 -08:00
kvm
linux net: fix recent csum changes 2021-12-06 16:26:46 -08:00
math-emu
media Merge branch 'akpm' (patches from Andrew) 2021-11-09 10:11:53 -08:00
memory
misc
net net: fix recent csum changes 2021-12-06 16:26:46 -08:00
pcmcia
ras
rdma RDMA/netlink: Add __maybe_unused to static inline in C file 2021-11-16 13:13:08 -04:00
scsi SCSI misc on 20211112 2021-11-12 12:25:50 -08:00
soc Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-11-26 13:45:19 -08:00
sound ASoC: Fixes for v5.16 2021-11-25 14:35:24 +01:00
target
trace NFS client bugfixes for Linux 5.16 2021-11-27 10:33:55 -08:00
uapi Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2021-12-02 11:44:56 -08:00
vdso
video
xen xen: add "not_essential" flag to struct xenbus_driver 2021-11-23 13:41:29 -06:00