diff options
author | Ralf Baechle <ralf@linux-mips.org> | 2017-01-26 04:16:47 +0300 |
---|---|---|
committer | Jiri Slaby <jslaby@suse.cz> | 2017-03-13 23:40:15 +0300 |
commit | 9245eb2ff54228b6ab2fcae449608279062b8eb2 (patch) | |
tree | 84a748f08284dd514bd1514b47d97b97bbff867d | |
parent | 26b65f1b9fbd674a4f350a869595a2293e14f453 (diff) | |
download | linux-9245eb2ff54228b6ab2fcae449608279062b8eb2.tar.xz |
MIPS: Fix special case in 64 bit IP checksumming.
commit 66fd848cadaa6be974a8c780fbeb328f0af4d3bd upstream.
For certain arguments such as saddr = 0xc0a8fd60, daddr = 0xc0a8fda1,
len = 80, proto = 17, sum = 0x7eae049d there will be a carry when
folding the intermediate 64 bit checksum to 32 bit but the code doesn't
add the carry back to the one's complement sum, thus an incorrect result
will be generated.
Reported-by: Mark Zhang <bomb.zhang@gmail.com>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Reviewed-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: James Hogan <james.hogan@imgtec.com>
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
-rw-r--r-- | arch/mips/include/asm/checksum.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h index ac3d2b8a20d4..d48cf440010c 100644 --- a/arch/mips/include/asm/checksum.h +++ b/arch/mips/include/asm/checksum.h @@ -155,7 +155,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, " daddu %0, %4 \n" " dsll32 $1, %0, 0 \n" " daddu %0, $1 \n" + " sltu $1, %0, $1 \n" " dsra32 %0, %0, 0 \n" + " addu %0, $1 \n" #endif " .set pop" : "=r" (sum) |