提交 cdd68193 编写于 作者: N Nikolay Shirokovskiy 提交者: John Ferlan

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.
上级 c9a191fc
...@@ -1248,6 +1248,8 @@ qemuAgentMakeStringsArray(const char **strings, unsigned int len) ...@@ -1248,6 +1248,8 @@ qemuAgentMakeStringsArray(const char **strings, unsigned int len)
void qemuAgentNotifyEvent(qemuAgentPtr mon, void qemuAgentNotifyEvent(qemuAgentPtr mon,
qemuAgentEvent event) qemuAgentEvent event)
{ {
virObjectLock(mon);
VIR_DEBUG("mon=%p event=%d await_event=%d", mon, event, mon->await_event); VIR_DEBUG("mon=%p event=%d await_event=%d", mon, event, mon->await_event);
if (mon->await_event == event) { if (mon->await_event == event) {
mon->await_event = QEMU_AGENT_EVENT_NONE; mon->await_event = QEMU_AGENT_EVENT_NONE;
...@@ -1257,6 +1259,8 @@ void qemuAgentNotifyEvent(qemuAgentPtr mon, ...@@ -1257,6 +1259,8 @@ void qemuAgentNotifyEvent(qemuAgentPtr mon,
virCondSignal(&mon->notify); virCondSignal(&mon->notify);
} }
} }
virObjectUnlock(mon);
} }
VIR_ENUM_DECL(qemuAgentShutdownMode); VIR_ENUM_DECL(qemuAgentShutdownMode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册