]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
parisc: Fix csum_ipv6_magic on 32-bit systems
authorGuenter Roeck <linux@roeck-us.net>
Sat, 10 Feb 2024 19:15:56 +0000 (11:15 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 3 Apr 2024 13:28:21 +0000 (15:28 +0200)
commitcabe3343acce04ba614e7a0aa40622f23ba13614
tree05ede466f65b7962ce847d43d5ed48d4a238e965
parentd31c8d0ca8bfbc44186941a47f165bad9409a8bc
parisc: Fix csum_ipv6_magic on 32-bit systems

[ Upstream commit 4408ba75e4ba80c91fde7e10bccccf388f5c09be ]

Calculating the IPv6 checksum on 32-bit systems missed overflows when
adding the proto+len fields into the checksum. This results in the
following unit test failure.

    # test_csum_ipv6_magic: ASSERTION FAILED at lib/checksum_kunit.c:506
    Expected ( u64)csum_result == ( u64)expected, but
        ( u64)csum_result == 46722 (0xb682)
        ( u64)expected == 46721 (0xb681)
    not ok 5 test_csum_ipv6_magic

This is probably rarely seen in the real world because proto+len are
usually small values which will rarely result in overflows when calculating
the checksum. However, the unit test code uses large values for the length
field, causing the test to fail.

Fix the problem by adding the missing carry into the final checksum.

Cc: Palmer Dabbelt <palmer@rivosinc.com>
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Tested-by: Charlie Jenkins <charlie@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>
Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/parisc/include/asm/checksum.h