aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRalf Baechle <[email protected]>2017-01-26 02:16:47 +0100
committerJames Hogan <[email protected]>2017-02-17 11:14:27 +0000
commit66fd848cadaa6be974a8c780fbeb328f0af4d3bd (patch)
tree0a23027a3d51c337df7e31a5f93adc1ab5638780
parent4da3273b93bd3715b05cc007ca07e5c12fa1e883 (diff)
MIPS: Fix special case in 64 bit IP checksumming.
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 <[email protected]> Signed-off-by: Ralf Baechle <[email protected]> Reviewed-by: James Hogan <[email protected]> Cc: [email protected] Signed-off-by: James Hogan <[email protected]>
-rw-r--r--arch/mips/include/asm/checksum.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/mips/include/asm/checksum.h b/arch/mips/include/asm/checksum.h
index 7749daf2a465..c8b574f7e0cc 100644
--- a/arch/mips/include/asm/checksum.h
+++ b/arch/mips/include/asm/checksum.h
@@ -186,7 +186,9 @@ static inline __wsum csum_tcpudp_nofold(__be32 saddr, __be32 daddr,
" 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)