Thread (12 messages) 12 messages, 3 authors, 2020-07-28

RE: [PATCH v2 1/6] ACPI: Add out of bounds and numa_off protections to pxm_to_node

From: Song Bao Hua (Barry Song) <hidden>
Date: 2020-07-18 05:09:33
Also in: linux-acpi, linux-mm, linux-pci

-----Original Message-----
From: Jonathan Cameron
Sent: Saturday, July 18, 2020 6:00 AM
To: linux-mm@kvack.org; linux-acpi@vger.kernel.org;
linux-arm-kernel@lists.infradead.org; x86@kernel.org
Cc: Lorenzo Pieralisi <redacted>; Bjorn Helgaas
[off-list ref]; linux-pci@vger.kernel.org; martin@geanix.com; Ingo
Molnar [off-list ref]; linux-ia64@vger.kernel.org; Tony Luck
[off-list ref]; Fenghua Yu [off-list ref]; Thomas
Gleixner [off-list ref]; Linuxarm [off-list ref]; Dan
Williams [off-list ref]; Song Bao Hua (Barry Song)
[off-list ref]; Jonathan Cameron
[off-list ref]
Subject: [PATCH v2 1/6] ACPI: Add out of bounds and numa_off protections to
pxm_to_node

The function should check the validity of the pxm value before using
it to index the pxm_to_node_map array.

Whilst hardening this code may be good in general, the main intent
here is to enable following patches that use this function to replace
acpi_map_pxm_to_node for non SRAT usecases which should return
NO_NUMA_NODE for PXM entries not matching with those in SRAT.

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Barry Song <redacted>
quoted hunk ↗ jump to hunk
---
 drivers/acpi/numa/srat.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/numa/srat.c b/drivers/acpi/numa/srat.c
index 5be5a977da1b..8ef44ee0d76b 100644
--- a/drivers/acpi/numa/srat.c
+++ b/drivers/acpi/numa/srat.c
@@ -31,7 +31,7 @@ int acpi_numa __initdata;

 int pxm_to_node(int pxm)
 {
-	if (pxm < 0)
+	if (pxm < 0 || pxm >= MAX_PXM_DOMAINS || numa_off)
 		return NUMA_NO_NODE;
 	return pxm_to_node_map[pxm];
 }
--
2.19.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help