Skip to contentSkip to conversation

acpi: check for pxm_to_node_map overflow

PATCH Applied [email protected] 2 participants 2 messages Mar 4, 2009 – Mar 16, 2009 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 7/8 acpi: check for pxm_to_node_map overflow

From: Cyrill Gorcunov <[email protected]>

It is hardly (if ever) possible but in case of broken _PXM entry we could reach out of pxm_to_node_map array bounds in acpi_map_pxm_to_node() call.

---

 drivers/acpi/numa.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/numa.c renamed from drivers/acpi/numa.c~acpi-check-for-pxm_to_node_map-overflow +1 -1
diff -puN drivers/acpi/numa.c~acpi-check-for-pxm_to_node_map-overflow drivers/acpi/numa.c
@@ -277,7 +277,7 @@ int acpi_get_node(acpi_handle *handle)
 	int pxm, node = -1;
 
 	pxm = acpi_get_pxm(handle);
-	if (pxm >= 0)
+	if (pxm >= 0 && pxm < MAX_PXM_DOMAINS)
 		node = acpi_map_pxm_to_node(pxm);
 
 	return node;

_

reviewer Applied
#1 lore raw

applied

thanks,
Len Brown, Intel Open Source Technology Center

Quoted 27 lines · On Wed, 4 Mar 2009, [email protected] wrote:

From: Cyrill Gorcunov <[email protected]>

It is hardly (if ever) possible but in case of broken _PXM entry we could reach out of pxm_to_node_map array bounds in acpi_map_pxm_to_node() call.

---

 drivers/acpi/numa.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff -puN drivers/acpi/numa.c~acpi-check-for-pxm_to_node_map-overflow drivers/acpi/numa.c

drivers/acpi/numa.c renamed from drivers/acpi/numa.c~acpi-check-for-pxm_to_node_map-overflow +1 -1
@@ -277,7 +277,7 @@ int acpi_get_node(acpi_handle *handle)
 	int pxm, node = -1;
 
 	pxm = acpi_get_pxm(handle);
-	if (pxm >= 0)
+	if (pxm >= 0 && pxm < MAX_PXM_DOMAINS)
 		node = acpi_map_pxm_to_node(pxm);
 
 	return node;

_