acpi: handle machines with no MCFG master origin/master current
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 14 Aug 2019 16:24:53 +0000 (12:24 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Wed, 14 Aug 2019 16:26:49 +0000 (12:26 -0400)
Syzkaller died during early boot after ACPI init and before/during PCI.
It's likely the VM it runs in doesn't have an MCFG, and we weren't
handling that case when PCI queried a device's MMIO config space.

Reported-by: syzbot+3feb100d5398d8b5d728@syzkaller.appspotmail.com
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/drivers/dev/acpi.c

index aa9f971..91e4d09 100644 (file)
@@ -1409,7 +1409,11 @@ static char *dumpmcfg(char *start, char *end, struct Atable *table)
 
 physaddr_t acpi_pci_get_mmio_cfg_addr(int segment, int bus, int dev, int func)
 {
-       struct acpi_mcfg_data *tbl = mcfgtbl->tbl;
+       struct acpi_mcfg_data *tbl;
+
+       if (!mcfgtbl)
+               return 0;
+       tbl = mcfgtbl->tbl;
 
        for (int i = 0; i < tbl->nr_entries; i++) {
                if (segment == tbl->entries[i].segment &&