Skip to contentSkip to conversation

ACPI: Make sure the FADT is at least rev 2 before using the reset register

PATCH In review Matthew Garrett 3 participants 3 messages Dec 10, 2010 – Dec 13, 2010 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: Make sure the FADT is at least rev 2 before using the reset register

The reset register was only introduced with version 2 of the FADT, so we should check that the FADT revision before trusting its contents.

---
 drivers/acpi/reboot.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/acpi/reboot.c +5 -0
index 4870aaa..a6c77e8b 100644
@@ -15,6 +15,11 @@ void acpi_reboot(void)
 
 	rr = &acpi_gbl_FADT.reset_register;
 
+	/* ACPI reset register was only introduced with v2 of the FADT */
+
+	if (acpi_gbl_FADT.header.revision < 2)
+		return;
+
 	/* Is the reset register supported? The spec says we should be
 	 * checking the bit width and bit offset, but Windows ignores
 	 * these fields */
Signature · 1 line
1.7.3.2
#1 lore raw
Quoted 3 lines · Matthew Garrett

The reset register was only introduced with version 2 of the FADT, so we should check that the FADT revision before trusting its contents.

does the current code break anything?
I'm curious about how you found this bug. :)

thanks,
rui

Quoted 21 lines
---
 drivers/acpi/reboot.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/acpi/reboot.c +5 -0
index 4870aaa..a6c77e8b 100644
@@ -15,6 +15,11 @@ void acpi_reboot(void)
 
 	rr = &acpi_gbl_FADT.reset_register;
 
+	/* ACPI reset register was only introduced with v2 of the FADT */
+
+	if (acpi_gbl_FADT.header.revision < 2)
+		return;
+
 	/* Is the reset register supported? The spec says we should be
 	 * checking the bit width and bit offset, but Windows ignores
 	 * these fields */
#2 lore raw
Quoted 6 lines · Zhang Rui
Quoted 3 lines · Matthew Garrett

The reset register was only introduced with version 2 of the FADT, so we should check that the FADT revision before trusting its contents.

does the current code break anything?
I'm curious about how you found this bug. :)

No, it just seems to be a sensible sanity check.