All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH,v2] arm64: fix the illegal address access in some cases
@ 2020-07-25  2:08 guodeqing
  2020-07-27 11:47 ` Catalin Marinas
  2020-07-28 13:03 ` Will Deacon
  0 siblings, 2 replies; 13+ messages in thread
From: guodeqing @ 2020-07-25  2:08 UTC (permalink / raw)
  To: catalin.marinas
  Cc: robin.murphy, luke.starrett, will, linux-arm-kernel, geffrey.guo

The ihl value of ip header is smaller than 5 in some cases, if the
ihl value is smaller than 5, then the next code will access the illegal
address, and the system will panic. ip_fast_csum() must be able to handle 
any value that could fit in the ihl field of the ip protocol header.

Here I add the check of the ihl value to solve this problem.

Fixes: 0e455d8e80aa (arm64: Implement optimised IP checksum helpers)
Signed-off-by: guodeqing <geffrey.guo@huawei.com>
---
 arch/arm64/include/asm/checksum.h | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/arch/arm64/include/asm/checksum.h b/arch/arm64/include/asm/checksum.h
index b6f7bc6..5a7d9ac 100644
--- a/arch/arm64/include/asm/checksum.h
+++ b/arch/arm64/include/asm/checksum.h
@@ -25,6 +25,9 @@ static inline __sum16 ip_fast_csum(const void *iph, unsigned int ihl)
 	__uint128_t tmp;
 	u64 sum;
 
+	if (unlikely(ihl < 5))
+		return 1;
+
 	tmp = *(const __uint128_t *)iph;
 	iph += 16;
 	ihl -= 4;
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2020-07-31  3:06 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-25  2:08 [PATCH,v2] arm64: fix the illegal address access in some cases guodeqing
2020-07-27 11:47 ` Catalin Marinas
2020-07-27 13:29   ` 答复: " Guodeqing (A)
2020-07-28  9:53     ` Catalin Marinas
2020-07-28 13:03 ` Will Deacon
2020-07-28 14:30   ` Robin Murphy
2020-07-28 15:35     ` Will Deacon
2020-07-29  7:05       ` 答复: " Guodeqing (A)
2020-07-30  8:44         ` Will Deacon
2020-07-30  9:56           ` Robin Murphy
2020-07-30 16:03             ` Will Deacon
2020-07-31  3:04             ` 答复: " Guodeqing (A)
2020-07-30 10:49           ` Guodeqing (A)

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.