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
This commit is contained in:
Daniel P. Berrange 2010-03-03 15:15:21 +00:00
parent 6ef5a5beeb
commit badfe6c75e

View File

@ -6854,6 +6854,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;