提交 badfe6c7 编写于 作者: D Daniel P. Berrange

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
上级 6ef5a5be
...@@ -6854,6 +6854,10 @@ static int qemudDomainDetachHostPciDevice(struct qemud_driver *driver, ...@@ -6854,6 +6854,10 @@ static int qemudDomainDetachHostPciDevice(struct qemud_driver *driver,
pciDevice *pci; pciDevice *pci;
for (i = 0 ; i < vm->def->nhostdevs ; i++) { 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 domain = vm->def->hostdevs[i]->source.subsys.u.pci.domain;
unsigned bus = vm->def->hostdevs[i]->source.subsys.u.pci.bus; unsigned bus = vm->def->hostdevs[i]->source.subsys.u.pci.bus;
unsigned slot = vm->def->hostdevs[i]->source.subsys.u.pci.slot; unsigned slot = vm->def->hostdevs[i]->source.subsys.u.pci.slot;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册