提交 a47b9e87 编写于 作者: L Laine Stump

qemu: fix infinite loop in OOM error path

A loop in qemuPrepareHostdevPCIDevices() intended to cycle through all
the objects on the list pcidevs was doing "while (listcount > 0)", but
nothing in the body of the loop was reducing the size of the list - it
was instead removing items from a *different* list. It has now been
safely changed to a for() loop.
上级 b2a2d00f
...@@ -638,8 +638,8 @@ inactivedevs: ...@@ -638,8 +638,8 @@ inactivedevs:
/* Only steal all the devices from driver->activePciHostdevs. We will /* Only steal all the devices from driver->activePciHostdevs. We will
* free them in virObjectUnref(). * free them in virObjectUnref().
*/ */
while (virPCIDeviceListCount(pcidevs) > 0) { for (i = 0; i < virPCIDeviceListCount(pcidevs); i++) {
virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, 0); virPCIDevicePtr dev = virPCIDeviceListGet(pcidevs, i);
virPCIDeviceListSteal(driver->activePciHostdevs, dev); virPCIDeviceListSteal(driver->activePciHostdevs, dev);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册