Just like qemuMonitorOpen(), hold the domain object locked
throughout the whole time of qemuConnectAgent() and unlock it
only for a brief time of actual connect() (because this is the
only part that has a potential of blocking).
The reason is that qemuAgentOpen() does access domain object
(well, its privateData) AND also at least one argument (@context)
depends on domain object. Accessing these without the lock is
potentially dangerous.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=
1845468#c12
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
goto cleanup;
}
+ virObjectUnlock(vm);
agent->fd = qemuAgentOpenUnix(config->data.nix.path);
+ virObjectLock(vm);
+
if (agent->fd == -1)
goto cleanup;
* deleted while the agent is active */
virObjectRef(vm);
- virObjectUnlock(vm);
-
agent = qemuAgentOpen(vm,
config->source,
virEventThreadGetContext(priv->eventThread),
&agentCallbacks,
virQEMUCapsGet(priv->qemuCaps, QEMU_CAPS_VSERPORT_CHANGE));
- virObjectLock(vm);
-
if (agent == NULL)
virObjectUnref(vm);