[PATCH v3 1/6] ACPI: Add out of bounds and numa_off protections to pxm_to_node
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- To: <linux-mm@xxxxxxxxx>, <linux-acpi@xxxxxxxxxxxxxxx>, <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>, <x86@xxxxxxxxxx>
- Subject: [PATCH v3 1/6] ACPI: Add out of bounds and numa_off protections to pxm_to_node
- From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
- Date: Tue, 18 Aug 2020 22:24:25 +0800
- Cc: Lorenzo Pieralisi <lorenzo.pieralisi@xxxxxxx>, Bjorn Helgaas <bhelgaas@xxxxxxxxxx>, <linux-pci@xxxxxxxxxxxxxxx>, <martin@xxxxxxxxxx>, Ingo Molnar <mingo@xxxxxxxxxx>, <linux-ia64@xxxxxxxxxxxxxxx>, Tony Luck <tony.luck@xxxxxxxxx>, Fenghua Yu <fenghua.yu@xxxxxxxxx>, Thomas Gleixner <tglx@xxxxxxxxxxxxx>, <linuxarm@xxxxxxxxxx>, Dan Williams <dan.j.williams@xxxxxxxxx>, Song Bao Hua <song.bao.hua@xxxxxxxxxxxxx>, Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx>
- In-reply-to: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com>
- References: <20200818142430.1156547-1-Jonathan.Cameron@huawei.com>
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@xxxxxxxxxx>
Reviewed-by: Barry Song <song.bao.hua@xxxxxxxxxxxxx>
Reviewed-by: Hanjun Guo <guohanjun@xxxxxxxxxx>
---
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 15bbaab8500b..1fb486f46ee2 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
[Index of Archives]
[Linux Kernel]
[Sparc Linux]
[DCCP]
[Linux ARM]
[Yosemite News]
[Linux SCSI]
[Linux x86_64]
[Linux for Ham Radio]