Commit 9bd6565c authored by MST's avatar MST 💬
Browse files

acpi: validate hotplug selector on access

When bus is looked up on a pci write, we didn't
validate that the lookup succeeded.
Fuzzers thus can trigger QEMU crash by dereferencing the NULL
bus pointer.

Fixes: b32bd763 ("pci: introduce acpi-index property for PCI device")
Fixes: CVE-2021-4158
Cc: "Igor Mammedov" <>
Fixes: #770

Signed-off-by: MST's avatarMichael S. Tsirkin <>
Reviewed-by: Philippe Mathieu-Daudé's avatarPhilippe Mathieu-Daudé <>
Reviewed-by: Ani Sinha's avatarAni Sinha <>
parent 7656d9ce
......@@ -491,6 +491,9 @@ static void pci_write(void *opaque, hwaddr addr, uint64_t data,
bus = acpi_pcihp_find_hotplug_bus(s, s->hotplug_select);
if (!bus) {
QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {
Object *o = OBJECT(kid->child);
PCIDevice *dev = PCI_DEVICE(o);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment