qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] acpi: validate hotplug selector on access
@ 2021-12-21 14:48 Michael S. Tsirkin
  2021-12-21 14:58 ` Philippe Mathieu-Daudé
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Michael S. Tsirkin @ 2021-12-21 14:48 UTC (permalink / raw)
  To: qemu-devel; +Cc: Ani Sinha, Igor Mammedov

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: b32bd763a1 ("pci: introduce acpi-index property for PCI device")
Cc: "Igor Mammedov" <imammedo@redhat.com>
Fixes: https://gitlab.com/qemu-project/qemu/-/issues/770
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/acpi/pcihp.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/hw/acpi/pcihp.c b/hw/acpi/pcihp.c
index 30405b5113..a5e182dd3a 100644
--- a/hw/acpi/pcihp.c
+++ b/hw/acpi/pcihp.c
@@ -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) {
+            break;
+        }
         QTAILQ_FOREACH_SAFE(kid, &bus->qbus.children, sibling, next) {
             Object *o = OBJECT(kid->child);
             PCIDevice *dev = PCI_DEVICE(o);
-- 
MST



^ permalink raw reply related	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2021-12-23 20:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-12-21 14:48 [PATCH] acpi: validate hotplug selector on access Michael S. Tsirkin
2021-12-21 14:58 ` Philippe Mathieu-Daudé
2021-12-21 16:37 ` Ani Sinha
2021-12-22 19:19 ` Philippe Mathieu-Daudé
2021-12-22 20:19   ` Michael S. Tsirkin
2021-12-22 20:27     ` Philippe Mathieu-Daudé
2021-12-22 20:52       ` Michael S. Tsirkin
2021-12-23  9:58         ` Mauro Matteo Cascella
2021-12-23 13:43           ` Michael S. Tsirkin
2021-12-23 20:46             ` Mauro Matteo Cascella

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).