Patch "parisc: Fix ip_fast_csum" has been added to the 4.19-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    parisc: Fix ip_fast_csum

to the 4.19-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     parisc-fix-ip_fast_csum.patch
and it can be found in the queue-4.19 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit da648d10829e55e3062bef8085c9e4ce3e5b6d37
Author: Guenter Roeck <linux@xxxxxxxxxxxx>
Date:   Sat Feb 10 09:55:26 2024 -0800

    parisc: Fix ip_fast_csum
    
    [ Upstream commit a2abae8f0b638c31bb9799d9dd847306e0d005bd ]
    
    IP checksum unit tests report the following error when run on hppa/hppa64.
    
        # test_ip_fast_csum: ASSERTION FAILED at lib/checksum_kunit.c:463
        Expected ( u64)csum_result == ( u64)expected, but
            ( u64)csum_result == 33754 (0x83da)
            ( u64)expected == 10946 (0x2ac2)
        not ok 4 test_ip_fast_csum
    
    0x83da is the expected result if the IP header length is 20 bytes. 0x2ac2
    is the expected result if the IP header length is 24 bytes. The test fails
    with an IP header length of 24 bytes. It appears that ip_fast_csum()
    always returns the checksum for a 20-byte header, no matter how long
    the header actually is.
    
    Code analysis shows a suspicious assembler sequence in ip_fast_csum().
    
     "      addc            %0, %3, %0\n"
     "1:    ldws,ma         4(%1), %3\n"
     "      addib,<         0, %2, 1b\n"    <---
    
    While my understanding of HPPA assembler is limited, it does not seem
    to make much sense to subtract 0 from a register and to expect the result
    to ever be negative. Subtracting 1 from the length parameter makes more
    sense. On top of that, the operation should be repeated if and only if
    the result is still > 0, so change the suspicious instruction to
     "      addib,>         -1, %2, 1b\n"
    
    The IP checksum unit test passes after this change.
    
    Cc: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
    Cc: stable@xxxxxxxxxxxxxxx
    Signed-off-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Tested-by: Charlie Jenkins <charlie@xxxxxxxxxxxx>
    Reviewed-by: Charlie Jenkins <charlie@xxxxxxxxxxxx>
    Signed-off-by: Helge Deller <deller@xxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/parisc/include/asm/checksum.h b/arch/parisc/include/asm/checksum.h
index c1c22819a04d1..7efcd901b9656 100644
--- a/arch/parisc/include/asm/checksum.h
+++ b/arch/parisc/include/asm/checksum.h
@@ -55,7 +55,7 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
 "	addc		%0, %5, %0\n"
 "	addc		%0, %3, %0\n"
 "1:	ldws,ma		4(%1), %3\n"
-"	addib,<		0, %2, 1b\n"
+"	addib,>		-1, %2, 1b\n"
 "	addc		%0, %3, %0\n"
 "\n"
 "	extru		%0, 31, 16, %4\n"




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux