mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-09-09 09:14:57 +00:00
qemu: Add missing lock in qemuProcessHandleMonitorEOF
qemuMonitorUnregister will be called in multiple threads (e.g. threads in rpc worker pool and the vm event thread). In some cases, it isn't protected by the monitor lock, which may lead to call g_source_unref more than one time and a use-after-free problem eventually. Add the missing lock in qemuProcessHandleMonitorEOF (which is the only position missing lock of monitor I found). Suggested-by: Michal Privoznik <mprivozn@redhat.com> Signed-off-by: Peng Liang <liangpeng10@huawei.com> Signed-off-by: Michal Privoznik <mprivozn@redhat.com> Reviewed-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
51722937ce
commit
1ac703a7d0
@ -318,7 +318,9 @@ qemuProcessHandleMonitorEOF(qemuMonitorPtr mon,
|
|||||||
/* We don't want this EOF handler to be called over and over while the
|
/* We don't want this EOF handler to be called over and over while the
|
||||||
* thread is waiting for a job.
|
* thread is waiting for a job.
|
||||||
*/
|
*/
|
||||||
|
virObjectLock(mon);
|
||||||
qemuMonitorUnregister(mon);
|
qemuMonitorUnregister(mon);
|
||||||
|
virObjectUnlock(mon);
|
||||||
|
|
||||||
/* We don't want any cleanup from EOF handler (or any other
|
/* We don't want any cleanup from EOF handler (or any other
|
||||||
* thread) to enter qemu namespace. */
|
* thread) to enter qemu namespace. */
|
||||||
|
Loading…
Reference in New Issue
Block a user