linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/boot: Handle malformed SRAT tables during early ACPI parsing
@ 2020-01-31  0:48 Steven Clarkson
  2020-01-31 18:55 ` Borislav Petkov
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Steven Clarkson @ 2020-01-31  0:48 UTC (permalink / raw)
  To: linux-kernel, Borislav Petkov; +Cc: Steven Clarkson

Break an infinite loop when early parsing SRAT caused by a subtable with
zero length. Known to affect the ASUS WS X299 SAGE motherboard with
firmware version 1201, which has a large block of zeros in its SRAT table.
The kernel could boot successfully on this board/firmware prior to the
introduction of early parsing this table.

Fixes: 02a3e3cdb7f1 ("x86/boot: Parse SRAT table and count immovable
memory regions")
Signed-off-by: Steven Clarkson <sc@lambdal.com>
---
 arch/x86/boot/compressed/acpi.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/x86/boot/compressed/acpi.c b/arch/x86/boot/compressed/acpi.c
index 25019d42ae93..1a4479c5edfc 100644
--- a/arch/x86/boot/compressed/acpi.c
+++ b/arch/x86/boot/compressed/acpi.c
@@ -394,6 +394,12 @@ int count_immovable_mem_regions(void)

        while (table + sizeof(struct acpi_subtable_header) < table_end) {
                sub_table = (struct acpi_subtable_header *)table;
+
+               if (!sub_table->length) {
+                       debug_putstr("Invalid zero length SRAT subtable.\n");
+                       break;
+               }
+
                if (sub_table->type == ACPI_SRAT_TYPE_MEMORY_AFFINITY) {
                        struct acpi_srat_mem_affinity *ma;

-- 
2.17.1

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-31 23:02 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-31  0:48 [PATCH] x86/boot: Handle malformed SRAT tables during early ACPI parsing Steven Clarkson
2020-01-31 18:55 ` Borislav Petkov
2020-01-31 23:00   ` Steven Clarkson
2020-01-31 23:02     ` Borislav Petkov
2020-01-31 18:58 ` [tip: x86/urgent] " tip-bot2 for Steven Clarkson
2020-01-31 19:10 ` tip-bot2 for Steven Clarkson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).