All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm64/numa: Add more vetting in numa_set_distance()
@ 2018-10-26 13:57 ` John Garry
  0 siblings, 0 replies; 26+ messages in thread
From: John Garry @ 2018-10-26 13:57 UTC (permalink / raw)
  To: catalin.marinas, will.deacon
  Cc: linux-arm-kernel, linux-kernel, linuxarm, John Garry

Currently it is acceptable to set the distance between 2 separate nodes to
LOCAL_DISTANCE.

Reject this as it is invalid.

This change avoids a crash reported in [1].

[1] https://www.spinics.net/lists/arm-kernel/msg683304.html

Signed-off-by: John Garry <john.garry@huawei.com>

diff --git a/arch/arm64/mm/numa.c b/arch/arm64/mm/numa.c
index 146c04c..6092e3d 100644
--- a/arch/arm64/mm/numa.c
+++ b/arch/arm64/mm/numa.c
@@ -335,7 +335,8 @@ void __init numa_set_distance(int from, int to, int distance)
 	}
 
 	if ((u8)distance != distance ||
-	    (from == to && distance != LOCAL_DISTANCE)) {
+	    (from == to && distance != LOCAL_DISTANCE) ||
+	    (from != to && distance == LOCAL_DISTANCE)) {
 		pr_warn_once("Warning: invalid distance parameter, from=%d to=%d distance=%d\n",
 			     from, to, distance);
 		return;
-- 
1.9.1


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

end of thread, other threads:[~2018-11-08 14:20 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-26 13:57 [PATCH] arm64/numa: Add more vetting in numa_set_distance() John Garry
2018-10-26 13:57 ` John Garry
2018-10-29 11:25 ` Will Deacon
2018-10-29 11:25   ` Will Deacon
2018-10-29 12:14   ` John Garry
2018-10-29 12:14     ` John Garry
2018-10-29 12:16     ` Will Deacon
2018-10-29 12:16       ` Will Deacon
2018-10-29 12:32       ` John Garry
2018-10-29 12:32         ` John Garry
2018-10-29 12:45         ` Anshuman Khandual
2018-10-29 12:45           ` Anshuman Khandual
2018-10-29 14:44           ` John Garry
2018-10-29 14:44             ` John Garry
2018-10-30  2:46             ` Anshuman Khandual
2018-10-30  2:46               ` Anshuman Khandual
2018-11-01 11:27               ` Will Deacon
2018-11-01 11:27                 ` Will Deacon
2018-11-01 11:39                 ` John Garry
2018-11-01 11:39                   ` John Garry
2018-11-08 14:20                 ` Anshuman Khandual
2018-11-08 14:20                   ` Anshuman Khandual
2018-10-29 14:48           ` Will Deacon
2018-10-29 14:48             ` Will Deacon
2018-10-30  3:00             ` Anshuman Khandual
2018-10-30  3:00               ` Anshuman Khandual

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.