Commit 6287f1a8 authored by Yuli Wang's avatar Yuli Wang Committed by Huacai Chen
Browse files

LoongArch: csum: Fix OoB access in IP checksum code for negative lengths



Commit 69e3a6aa ("LoongArch: Add checksum optimization for 64-bit
system") would cause an undefined shift and an out-of-bounds read.

Commit 8bd795fe ("arm64: csum: Fix OoB access in IP checksum code
for negative lengths") fixes the same issue on ARM64.

Fixes: 69e3a6aa ("LoongArch: Add checksum optimization for 64-bit system")
Co-developed-by: default avatarWentao Guan <guanwentao@uniontech.com>
Signed-off-by: default avatarWentao Guan <guanwentao@uniontech.com>
Signed-off-by: default avatarYuli Wang <wangyuli@uniontech.com>
Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
parent 6b72cd9e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ unsigned int __no_sanitize_address do_csum(const unsigned char *buff, int len)
	const u64 *ptr;
	u64 data, sum64 = 0;

	if (unlikely(len == 0))
	if (unlikely(len <= 0))
		return 0;

	offset = (unsigned long)buff & 7;