Message ID | 20230921092311.15578-1-liucong2@kylinos.cn |
---|---|
State | New |
Headers | show |
Series | [v2] plugins/hotblocks: Fix potential deadlock in plugin_exit() function | expand |
On 21/9/23 11:23, 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. > > Signed-off-by: Cong Liu <liucong2@kylinos.cn> > Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org> Not really suggested, just reviewed ;) Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> > --- > contrib/plugins/hotblocks.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c > index 6b74d25fead6..b99b93ad8dc7 100644 > --- a/contrib/plugins/hotblocks.c > +++ b/contrib/plugins/hotblocks.c > @@ -69,9 +69,9 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) > } > > g_list_free(it); > - g_mutex_unlock(&lock); > } > > + g_mutex_unlock(&lock); > qemu_plugin_outs(report->str); > } >
diff --git a/contrib/plugins/hotblocks.c b/contrib/plugins/hotblocks.c index 6b74d25fead6..b99b93ad8dc7 100644 --- a/contrib/plugins/hotblocks.c +++ b/contrib/plugins/hotblocks.c @@ -69,9 +69,9 @@ static void plugin_exit(qemu_plugin_id_t id, void *p) } g_list_free(it); - g_mutex_unlock(&lock); } + g_mutex_unlock(&lock); qemu_plugin_outs(report->str); }
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. Signed-off-by: Cong Liu <liucong2@kylinos.cn> Suggested-by: Philippe Mathieu-Daudé <philmd@linaro.org> --- contrib/plugins/hotblocks.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)