iothread: check iothread->ctx before aio_context_unref to avoid assertion
PATCH 1/1 iothread: check iothread->ctx before aio_context_unref to avoid assertion
if iothread->ctx is set to NULL, aio_context_unref triggers the assertion:g_source_unref: assertion 'source != NULL' failed.
The patch fixes it.
Signed-off-by Lin Ma <[email protected]>
--- iothread.c | 3 +++ 1 file changed, 3 insertions(+)
iothread.c +3 -0
@@ -75,6 +75,9 @@ static void iothread_instance_finalize(Object *obj)iothread_stop (obj,NULL );qemu_cond_destroy (&iothread->init_done_cond);qemu_mutex_destroy (&iothread->init_done_lock); +if (!iothread->ctx) { +return ; + }aio_context_unref (iothread->ctx); }
Signature · 1 line
2.9.2
Quoted 15 lines · Lin Ma
if
iothread->ctxis set to NULL,aio_context_unreftriggers the assertion:g_source_unref: assertion 'source != NULL' failed.
The patch fixes it.Signed-off-by Lin Ma <[email protected]>--- iothread.c | 3 +++ 1 file changed, 3 insertions(+)iothread.c +0
-0
iothread.c static void iothread_instance_finalize(Object *obj) · line 83
Quoted 9 lines
iothread.c +3
-0@@ -75,6 +75,9 @@ static void iothread_instance_finalize(Object *obj)iothread_stop (obj,NULL );qemu_cond_destroy (&iothread->init_done_cond);qemu_mutex_destroy (&iothread->init_done_lock); +if (!iothread->ctx) { +return ; + }aio_context_unref (iothread->ctx); }
This only happens if there is an error, but it's theoretically possible.
Reviewed-by Paolo Bonzini <[email protected]>
Stefan Hajnoczi
AppliedQuoted 8 lines · Lin Ma
if
iothread->ctxis set to NULL,aio_context_unreftriggers the assertion:g_source_unref: assertion 'source != NULL' failed.
The patch fixes it.Signed-off-by Lin Ma <[email protected]>--- iothread.c | 3 +++ 1 file changed, 3 insertions(+)
Thanks, applied to my block tree:
https://github.com/stefanha/qemu/commits/block
Stefan