mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-01-10 23:07:44 +00:00
qemu: don't use vm when lock is dropped in qemuDomainGetFSInfo
Current call to qemuAgentGetFSInfo in qemuDomainGetFSInfo is unsafe. Domain lock is dropped and we use vm->def. Let's make def copy to fix that.
This commit is contained in:
parent
3ab9652a86
commit
c9a191fc48
@ -19784,6 +19784,8 @@ qemuDomainGetFSInfo(virDomainPtr dom,
|
|||||||
virQEMUDriverPtr driver = dom->conn->privateData;
|
virQEMUDriverPtr driver = dom->conn->privateData;
|
||||||
virDomainObjPtr vm;
|
virDomainObjPtr vm;
|
||||||
qemuAgentPtr agent;
|
qemuAgentPtr agent;
|
||||||
|
virCapsPtr caps = NULL;
|
||||||
|
virDomainDefPtr def = NULL;
|
||||||
int ret = -1;
|
int ret = -1;
|
||||||
|
|
||||||
virCheckFlags(0, ret);
|
virCheckFlags(0, ret);
|
||||||
@ -19806,8 +19808,14 @@ qemuDomainGetFSInfo(virDomainPtr dom,
|
|||||||
if (!qemuDomainAgentAvailable(vm, true))
|
if (!qemuDomainAgentAvailable(vm, true))
|
||||||
goto endjob;
|
goto endjob;
|
||||||
|
|
||||||
|
if (!(caps = virQEMUDriverGetCapabilities(driver, false)))
|
||||||
|
goto endjob;
|
||||||
|
|
||||||
|
if (!(def = virDomainDefCopy(vm->def, caps, driver->xmlopt, NULL, false)))
|
||||||
|
goto endjob;
|
||||||
|
|
||||||
agent = qemuDomainObjEnterAgent(vm);
|
agent = qemuDomainObjEnterAgent(vm);
|
||||||
ret = qemuAgentGetFSInfo(agent, info, vm->def);
|
ret = qemuAgentGetFSInfo(agent, info, def);
|
||||||
qemuDomainObjExitAgent(vm, agent);
|
qemuDomainObjExitAgent(vm, agent);
|
||||||
|
|
||||||
endjob:
|
endjob:
|
||||||
@ -19815,6 +19823,8 @@ qemuDomainGetFSInfo(virDomainPtr dom,
|
|||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
virDomainObjEndAPI(&vm);
|
virDomainObjEndAPI(&vm);
|
||||||
|
virDomainDefFree(def);
|
||||||
|
virObjectUnref(caps);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user