qemuAgentNotifyEvent accesses monitor structure and is called on qemu
reset/shutdown/suspend events under domain lock. Other monitor
functions on the other hand take monitor lock and don't hold domain lock.
Thus it is possible to have risky simultaneous access to the structure
from 2 threads. Let's take monitor lock here to make access exclusive.
void qemuAgentNotifyEvent(qemuAgentPtr mon,
qemuAgentEvent event)
{
+ virObjectLock(mon);
+
VIR_DEBUG("mon=%p event=%d await_event=%d", mon, event, mon->await_event);
if (mon->await_event == event) {
mon->await_event = QEMU_AGENT_EVENT_NONE;
virCondSignal(&mon->notify);
}
}
+
+ virObjectUnlock(mon);
}
VIR_ENUM_DECL(qemuAgentShutdownMode);