mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] ACPI: ADXL: verify component name types
@ 2026-11-03 11:41 Kang Chen
  2026-11-03 17:05 ` Luck, Tony
  0 siblings, 1 reply; 2+ messages in thread
From: Kang Chen @ 2026-11-03 11:41 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Len Brown, Tony Luck, Borislav Petkov, linux-acpi, linux-kernel

adxl_init() stores p[i].string.pointer for every component name
without checking that the element is a string.  An integer element
makes the pointer the integer value, which adxl_decode() consumers
dereference with strcmp() and %s, causing a wild read during boot on
machines with an ADXL object.

Reject the interface if any component name is not a string.

Fixes: 4cf841e39850 ("ACPI/ADXL: Add address translation interface using an ACPI DSM")
Signed-off-by: Kang Chen <k.chen@smail.nju.edu.cn>
---
 drivers/acpi/acpi_adxl.c | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/acpi_adxl.c b/drivers/acpi/acpi_adxl.c
index 13c8f7b50c46..de646b312eba 100644
--- a/drivers/acpi/acpi_adxl.c
+++ b/drivers/acpi/acpi_adxl.c
@@ -184,8 +184,17 @@ static int __init adxl_init(void)
 		return -ENOMEM;
 	}
 
-	for (i = 0; i < adxl_count; i++)
+	for (i = 0; i < adxl_count; i++) {
+		if (p[i].type != ACPI_TYPE_STRING) {
+			pr_info("Bad component name type %d\n", p[i].type);
+			kfree(adxl_component_names);
+			adxl_component_names = NULL;
+			ACPI_FREE(params);
+			params = NULL;
+			return -ENODEV;
+		}
 		adxl_component_names[i] = p[i].string.pointer;
+	}
 
 	return 0;
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-11-03 17:06 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-03 11:41 [PATCH] ACPI: ADXL: verify component name types Kang Chen
2026-11-03 17:05 ` Luck, Tony

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®