qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] iothread: check iothread->ctx before aio_contex


From: Paolo Bonzini
Subject: Re: [Qemu-devel] [PATCH] iothread: check iothread->ctx before aio_context_unref to avoid assertion
Date: Mon, 26 Sep 2016 09:06:16 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0


On 26/09/2016 07:29, Lin Ma wrote:
> 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 <address@hidden>
> ---
>  iothread.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/iothread.c b/iothread.c
> index fb08a60..fbeb8de 100644
> --- a/iothread.c
> +++ b/iothread.c
> @@ -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 <address@hidden>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]