acpi: Check ACPI revision before accessing XSDT

This field is only present in revisions after zero, so add the missing
check. This avoids a buffer overrun with a revision 1.0 ACPI table.

Signed-off-by: Simon Glass <sjg@chromium.org>
Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
This commit is contained in:
Simon Glass
2025-08-20 06:30:22 -06:00
parent e3f391bef6
commit d390d1316f

View File

@@ -81,7 +81,7 @@ static int setup_search(struct acpi_rsdt **rsdtp, struct acpi_xsdt **xsdtp)
return -ENOENT;
if (!acpi_valid_rsdp(rsdp))
return -EINVAL;
if (rsdp->xsdt_address) {
if (rsdp->revision > 1 && rsdp->xsdt_address) {
xsdt = nomap_sysmem(rsdp->xsdt_address, 0);
len = xsdt->header.length - sizeof(xsdt->header);
count = len / sizeof(u64);