Skip to content

Commit a7e0f23

Browse files
jic23gregkh
authored andcommitted
ACPI: Add out of bounds and numa_off protections to pxm_to_node()
[ Upstream commit 8a3deca ] 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 <song.bao.hua@hisilicon.com> Reviewed-by: Hanjun Guo <guohanjun@huawei.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent d791896 commit a7e0f23

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

drivers/acpi/numa/srat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ int acpi_numa __initdata;
3131

3232
int pxm_to_node(int pxm)
3333
{
34-
if (pxm < 0)
34+
if (pxm < 0 || pxm >= MAX_PXM_DOMAINS || numa_off)
3535
return NUMA_NO_NODE;
3636
return pxm_to_node_map[pxm];
3737
}

0 commit comments

Comments
 (0)