Hi Cong,
On 21/9/23 08:12, Cong Liu wrote:
This patch fixes a potential deadlock in the plugin_exit() function of QEMU.
The original code does not release the lock mutex if it is NULL. This patch
adds a check for it being NULL and releases the mutex in that case.
You are correct.
Signed-off-by: Cong Liu <liuco...@kylinos.cn>
---
contrib/plugins/hotblocks.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c
index 6b74d25fead6..1f713f1904f3 100644
--- a/contrib/plugins/hotblocks.c
+++ b/contrib/plugins/hotblocks.c
@@ -70,6 +70,8 @@ static void plugin_exit(qemu_plugin_id_t id, void *p)
g_list_free(it);
g_mutex_unlock(&lock);
+ } else {
+ g_mutex_unlock(&lock);
}
The code stays simpler if you simply move the unlock call out
of the if() statement, here.
qemu_plugin_outs(report->str);
Regards,
Phil.