]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
ACPI: SPCR: Check for table version when using precise baudrate
authorPunit Agrawal <punit.agrawal@oss.qualcomm.com>
Fri, 24 Oct 2025 12:31:25 +0000 (13:31 +0100)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 27 Oct 2025 19:43:41 +0000 (20:43 +0100)
Commit 4d330fe54145 ("ACPI: SPCR: Support Precise Baud Rate field")
added support to use the precise baud rate available since SPCR 1.09
(revision 4) but failed to check the version of the table provided by
the firmware.

Accessing an older version of SPCR table causes accesses beyond the
end of the table and can lead to garbage data to be used for the baud
rate.

Check the version of the firmware provided SPCR to ensure that the
precise baudrate is vaild before using it.

Fixes: 4d330fe54145 ("ACPI: SPCR: Support Precise Baud Rate field")
Signed-off-by: Punit Agrawal <punit.agrawal@oss.qualcomm.com>
Link: https://patch.msgid.link/20251024123125.1081612-1-punit.agrawal@oss.qualcomm.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/spcr.c

index d4d52d5e9016ca8278e99c9fd81b48c85510d3be..73cb933fdc89b224fde101da2e1afadb7ea1f557 100644 (file)
@@ -155,7 +155,7 @@ int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)
         * Baud Rate field. If this field is zero or not present, Configured
         * Baud Rate is used.
         */
-       if (table->precise_baudrate)
+       if (table->header.revision >= 4 && table->precise_baudrate)
                baud_rate = table->precise_baudrate;
        else switch (table->baud_rate) {
        case 0: