Blob Blame History Raw
From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Date: Tue, 18 Aug 2020 22:24:29 +0800
Subject: ACPI: Remove side effect of partly creating a node in acpi_get_node()
Patch-mainline: v5.10-rc1
Git-commit: a62d07e0006a3a3ce77041ca07f3c488ec880790
References: jsc#SLE-16407

acpi_get_node() calls acpi_get_pxm() to evaluate the _PXM AML method
for entries found in DSDT/SSDT. ACPI 6.3 sec 6.2.14 states
"_PXM evaluates to an integer that identifies a device as belonging to
 a Proximity Domain defined in the System Resource Affinity Table (SRAT)."
Hence a _PXM method should not result in creation of a new NUMA node.

Before this patch, _PXM could result in partial instantiation of
NUMA node, missing elements such as zone lists.  A call to
devm_kzalloc(), for example, results in a NULL pointer dereference.

This patch therefore replaces the acpi_map_pxm_to_node() with a call
to pxm_to_node().

Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Reviewed-by: Hanjun Guo <guohanjun@huawei.com>
Reviewed-by: Barry Song <song.bao.hua@hisilicon.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Acked-by: Lee, Chun-Yi <jlee@suse.com>
---
 drivers/acpi/numa/srat.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/acpi/numa/srat.c
+++ b/drivers/acpi/numa/srat.c
@@ -440,6 +440,6 @@ int acpi_get_node(acpi_handle handle)
 
 	pxm = acpi_get_pxm(handle);
 
-	return acpi_map_pxm_to_node(pxm);
+	return pxm_to_node(pxm);
 }
 EXPORT_SYMBOL(acpi_get_node);