ACPI: Make sure the FADT is at least rev 2 before using the reset register
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.
Signed-off-by Matthew Garrett <[email protected]>
--- drivers/acpi/reboot.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)
drivers/acpi/reboot.c +5 -0
@@ -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
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
Signed-off-by Matthew Garrett <[email protected]>--- drivers/acpi/reboot.c | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)drivers/acpi/reboot.c +5
-0@@ -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 */
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.