[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230925214046.1051350-1-anarsoul@gmail.com>
Date: Mon, 25 Sep 2023 14:40:21 -0700
From: Vasily Khoruzhick <anarsoul@...il.com>
To: "Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>, Zhang Rui <rui.zhang@...el.com>,
linux-acpi@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Vasily Khoruzhick <anarsoul@...il.com>, stable@...r.kernel.org
Subject: [PATCH] ACPI: FPDT: break out of the loop if record length is zero
Buggy BIOSes may have zero-length records in FPDT, table, as a result
fpdt_process_subtable() spins in eternal loop.
Break out of the loop if record length is zero.
Fixes: d1eb86e59be0 ("ACPI: tables: introduce support for FPDT table")
Cc: stable@...r.kernel.org
Signed-off-by: Vasily Khoruzhick <anarsoul@...il.com>
---
drivers/acpi/acpi_fpdt.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/acpi/acpi_fpdt.c b/drivers/acpi/acpi_fpdt.c
index a2056c4c8cb7..53d8f9601a55 100644
--- a/drivers/acpi/acpi_fpdt.c
+++ b/drivers/acpi/acpi_fpdt.c
@@ -194,6 +194,11 @@ static int fpdt_process_subtable(u64 address, u32 subtable_type)
record_header = (void *)subtable_header + offset;
offset += record_header->length;
+ if (!record_header->length) {
+ pr_info(FW_BUG "Zero-length record found.\n");
+ break;
+ }
+
switch (record_header->type) {
case RECORD_S3_RESUME:
if (subtable_type != SUBTABLE_S3PT) {
--
2.42.0
Powered by blists - more mailing lists