From: Peter Krempa Date: Tue, 27 Oct 2015 06:29:53 +0000 (+0100) Subject: qemu: qemuDomainSetVcpusAgent: re-check agent before calling it the again X-Git-Tag: CVE-2015-5313~39 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2642a36db5d54bc4507e601f4e7bac8de7618129;p=thirdparty%2Flibvirt.git qemu: qemuDomainSetVcpusAgent: re-check agent before calling it the again With a very unfortunate timing, the agent might vanish before we do the second call while the locks were down. Re-check that the agent is available before attempting it again. --- diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 62f1054393..7a99ed244f 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -4881,6 +4881,9 @@ qemuDomainSetVcpusAgent(virDomainObjPtr vm, if (qemuAgentUpdateCPUInfo(nvcpus, cpuinfo, ncpuinfo) < 0) goto cleanup; + if (!qemuDomainAgentAvailable(vm, true)) + goto cleanup; + qemuDomainObjEnterAgent(vm); ret = qemuAgentSetVCPUs(qemuDomainGetAgent(vm), cpuinfo, ncpuinfo); qemuDomainObjExitAgent(vm);