Skip to content

Commit 2b73ea3

Browse files
sclarksonsuryasaimadhu
authored andcommitted
x86/boot: Handle malformed SRAT tables during early ACPI parsing
Break an infinite loop when early parsing of the SRAT table is 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 or after a BIOS update. [ bp: Fixup whitespace damage and commit message. Make it return 0 to denote that there are no immovable regions because who knows what else is broken in this BIOS. ] Fixes: 02a3e3c ("x86/boot: Parse SRAT table and count immovable memory regions") Signed-off-by: Steven Clarkson <[email protected]> Signed-off-by: Borislav Petkov <[email protected]> Cc: [email protected] Link: https://bugzilla.kernel.org/show_bug.cgi?id=206343 Link: https://lkml.kernel.org/r/CAHKq8taGzj0u1E_i=poHUam60Bko5BpiJ9jn0fAupFUYexvdUQ@mail.gmail.com
1 parent 9799238 commit 2b73ea3

File tree

1 file changed

+6
-0
lines changed
  • arch/x86/boot/compressed

1 file changed

+6
-0
lines changed

arch/x86/boot/compressed/acpi.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,13 @@ int count_immovable_mem_regions(void)
393393
table = table_addr + sizeof(struct acpi_table_srat);
394394

395395
while (table + sizeof(struct acpi_subtable_header) < table_end) {
396+
396397
sub_table = (struct acpi_subtable_header *)table;
398+
if (!sub_table->length) {
399+
debug_putstr("Invalid zero length SRAT subtable.\n");
400+
return 0;
401+
}
402+
397403
if (sub_table->type == ACPI_SRAT_TYPE_MEMORY_AFFINITY) {
398404
struct acpi_srat_mem_affinity *ma;
399405

0 commit comments

Comments
 (0)