acpi: handle machines with no MCFG
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>
diff --git a/kern/drivers/dev/acpi.c b/kern/drivers/dev/acpi.c
index aa9f971..91e4d09 100644
--- a/kern/drivers/dev/acpi.c
+++ b/kern/drivers/dev/acpi.c
@@ -1409,7 +1409,11 @@
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 &&