mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-03-07 17:28:15 +00:00
qemu: agent: take monitor lock in qemuAgentNotifyEvent
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.
This commit is contained in:
parent
c9a191fc48
commit
cdd6819318
@ -1248,6 +1248,8 @@ qemuAgentMakeStringsArray(const char **strings, unsigned int len)
|
||||
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;
|
||||
@ -1257,6 +1259,8 @@ void qemuAgentNotifyEvent(qemuAgentPtr mon,
|
||||
virCondSignal(&mon->notify);
|
||||
}
|
||||
}
|
||||
|
||||
virObjectUnlock(mon);
|
||||
}
|
||||
|
||||
VIR_ENUM_DECL(qemuAgentShutdownMode);
|
||||
|
Loading…
x
Reference in New Issue
Block a user