mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-25 15:15:25 +00:00
Fix crash when cleaning up from failed save attempt
If a transient QEMU crashes during save attempt, then the virDomainPtr object may be freed. If a persistent QEMU crashes during save, then the 'priv->mon' field is no longer valid since it will be inactive. * src/qemu/qemu_driver.c: Fix two crashes when QEMU exits during a save attempt
This commit is contained in:
parent
ed7813d28d
commit
d7e0fe6e9f
@ -4924,19 +4924,20 @@ static int qemudDomainSaveFlag(virDomainPtr dom, const char *path,
|
||||
}
|
||||
|
||||
endjob:
|
||||
if (ret != 0 && header.was_running) {
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
rc = qemuMonitorStartCPUs(priv->mon, dom->conn);
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
if (rc < 0)
|
||||
VIR_WARN0("Unable to resume guest CPUs after save failure");
|
||||
else
|
||||
vm->state = VIR_DOMAIN_RUNNING;
|
||||
}
|
||||
if (vm) {
|
||||
if (ret != 0 && header.was_running && priv->mon) {
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
rc = qemuMonitorStartCPUs(priv->mon, dom->conn);
|
||||
qemuDomainObjExitMonitorWithDriver(driver, vm);
|
||||
if (rc < 0)
|
||||
VIR_WARN0("Unable to resume guest CPUs after save failure");
|
||||
else
|
||||
vm->state = VIR_DOMAIN_RUNNING;
|
||||
}
|
||||
|
||||
if (vm &&
|
||||
qemuDomainObjEndJob(vm) == 0)
|
||||
if (qemuDomainObjEndJob(vm) == 0)
|
||||
vm = NULL;
|
||||
}
|
||||
|
||||
cleanup:
|
||||
VIR_FREE(xml);
|
||||
@ -7110,9 +7111,16 @@ static int qemudDomainAttachNetDevice(virConnectPtr conn,
|
||||
}
|
||||
|
||||
/* FIXME - need to support vhost-net here (5th arg) */
|
||||
if (!(netstr = qemuBuildHostNetStr(net, ' ',
|
||||
vlan, tapfd_name, 0)))
|
||||
goto try_tapfd_close;
|
||||
if ((qemuCmdFlags & QEMUD_CMD_FLAG_NETDEV) &&
|
||||
(qemuCmdFlags & QEMUD_CMD_FLAG_DEVICE)) {
|
||||
if (!(netstr = qemuBuildHostNetStr(net, ',',
|
||||
-1, tapfd_name, 0)))
|
||||
goto try_tapfd_close;
|
||||
} else {
|
||||
if (!(netstr = qemuBuildHostNetStr(net, ' ',
|
||||
vlan, tapfd_name, 0)))
|
||||
goto try_tapfd_close;
|
||||
}
|
||||
|
||||
qemuDomainObjEnterMonitorWithDriver(driver, vm);
|
||||
if (qemuMonitorAddHostNetwork(priv->mon, netstr) < 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user