[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[libvirt] [PATCH 2/4] Add missing device type check in QEMU PCI hotunplug



The QEMU hotunplug code for PCI devices was looking at host
devices in the guest config without first filtering non
PCI devices. This means it was reading garbage

* src/qemu/qemu_driver.c: Filter out non-PCI devices
---
 src/qemu/qemu_driver.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
index b520ce0..4dd5843 100644
--- a/src/qemu/qemu_driver.c
+++ b/src/qemu/qemu_driver.c
@@ -6559,6 +6559,10 @@ static int qemudDomainDetachHostPciDevice(struct qemud_driver *driver,
     pciDevice *pci;
 
     for (i = 0 ; i < vm->def->nhostdevs ; i++) {
+        if (vm->def->hostdevs[i]->mode != VIR_DOMAIN_HOSTDEV_MODE_SUBSYS ||
+            vm->def->hostdevs[i]->source.subsys.type != VIR_DOMAIN_HOSTDEV_SUBSYS_TYPE_PCI)
+            continue;
+
         unsigned domain   = vm->def->hostdevs[i]->source.subsys.u.pci.domain;
         unsigned bus      = vm->def->hostdevs[i]->source.subsys.u.pci.bus;
         unsigned slot     = vm->def->hostdevs[i]->source.subsys.u.pci.slot;
-- 
1.6.5.2


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]