Skip to contentSkip to conversation

ACPI: SPCR: Check for table version when using precise baudrate

PATCH Applied Punit Agrawal 2 participants 2 messages Oct 24, 2025 – Oct 27, 2025 ACPI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ACPI: SPCR: Check for table version when using precise baudrate

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")
---
 drivers/acpi/spcr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/spcr.c +1 -1
index d4d52d5e9016..73cb933fdc89 100644
@@ -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:
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 22 lines · Punit Agrawal

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")
---
 drivers/acpi/spcr.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/acpi/spcr.c +0 -0
index d4d52d5e9016..73cb933fdc89 100644

drivers/acpi/spcr.c int __init acpi_parse_spcr(bool enable_earlycon, bool enable_console)

Quoted 9 lines
drivers/acpi/spcr.c +1 -2
@@ -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:
--

Applied as 6.18-rc material, thanks!