Skip to content

Commit 6287f1a

Browse files
Avenger-285714chenhuacai
authored andcommitted
LoongArch: csum: Fix OoB access in IP checksum code for negative lengths
Commit 69e3a6a ("LoongArch: Add checksum optimization for 64-bit system") would cause an undefined shift and an out-of-bounds read. Commit 8bd795f ("arm64: csum: Fix OoB access in IP checksum code for negative lengths") fixes the same issue on ARM64. Fixes: 69e3a6a ("LoongArch: Add checksum optimization for 64-bit system") Co-developed-by: Wentao Guan <[email protected]> Signed-off-by: Wentao Guan <[email protected]> Signed-off-by: Yuli Wang <[email protected]> Signed-off-by: Huacai Chen <[email protected]>
1 parent 6b72cd9 commit 6287f1a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/loongarch/lib/csum.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len)
2525
const u64 *ptr;
2626
u64 data, sum64 = 0;
2727

28-
if (unlikely(len == 0))
28+
if (unlikely(len <= 0))
2929
return 0;
3030

3131
offset = (unsigned long)buff & 7;

0 commit comments

Comments
 (0)