]> git.ipfire.org Git - thirdparty/libvirt.git/commit
tests: fix double unlock of monitor in hotplug test
authorDaniel P. Berrangé <berrange@redhat.com>
Thu, 12 Mar 2020 18:33:51 +0000 (18:33 +0000)
committerDaniel P. Berrangé <berrange@redhat.com>
Fri, 13 Mar 2020 11:27:57 +0000 (11:27 +0000)
commit46e16b553dc82235cf8b412dc703d5fc7c1e4c09
treef4fdc22a9c458ffadb7852036dd63593a7e9b59d
parent2695191a44eb7375225b4ad073825ed3563a172a
tests: fix double unlock of monitor in hotplug test

The qemuMonitorTestNew() function returns with the monitor object
locked, and expects it to still be locked when qemuMonitorTestFree
is called.  The qemuhotplug test, however, explicitly unlocks the
monitor, but then forgets to lock it again. As a result the
qemuMonitorTestFree function is unlocking a mutex it doesn't own.

This bug has existed forever, but since we use normal POSIX mutexes
and don't check the return value of pthread_mutex_lock/unlock we
didn't see the error. It was harmless until the switch to the per
monitor event loop which requires the thread synchronization to
work reliably, whereupon it started crashing.

Reviewed-by: Peter Krempa <pkrempa@redhat.com>
Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
tests/qemuhotplugtest.c