You need to sign in or sign up before continuing.
提交 db19417f 编写于 作者: P Peter Krempa

qemu_hotplug: Don't free the PCI device structure after hot-unplug

The pciDevice structure corresponding to the device being hot-unplugged
was freed after it was "stolen" from activeList. The pointer was still
used for eg-inactive list. This patch removes the free of the structure
and frees it only if reset fails on the device.
上级 3404729e
...@@ -2004,13 +2004,16 @@ qemuDomainDetachHostPciDevice(struct qemud_driver *driver, ...@@ -2004,13 +2004,16 @@ qemuDomainDetachHostPciDevice(struct qemud_driver *driver,
subsys->u.pci.slot, subsys->u.pci.function); subsys->u.pci.slot, subsys->u.pci.function);
if (pci) { if (pci) {
activePci = pciDeviceListSteal(driver->activePciHostdevs, pci); activePci = pciDeviceListSteal(driver->activePciHostdevs, pci);
if (pciResetDevice(activePci, driver->activePciHostdevs, if (activePci &&
driver->inactivePciHostdevs) == 0) pciResetDevice(activePci, driver->activePciHostdevs,
driver->inactivePciHostdevs) == 0) {
qemuReattachPciDevice(activePci, driver); qemuReattachPciDevice(activePci, driver);
else } else {
/* reset of the device failed, treat it as if it was returned */
pciFreeDevice(activePci);
ret = -1; ret = -1;
}
pciFreeDevice(pci); pciFreeDevice(pci);
pciFreeDevice(activePci);
} else { } else {
ret = -1; ret = -1;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册