All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Lin Ma <lma@suse.com>, qemu-devel@nongnu.org
Cc: famz@redhat.com, stefanha@redhat.com
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	[thread overview]
Message-ID: <7d94ae26-5eb5-5213-ce41-dd829fe9c135@redhat.com> (raw)
In-Reply-To: <20160926052958.10716-1-lma@suse.com>



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 <lma@suse.com>
> ---
>  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 <pbonzini@redhat.com>

  reply	other threads:[~2016-09-26  7:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-26  5:29 [Qemu-devel] [PATCH] iothread: check iothread->ctx before aio_context_unref to avoid assertion Lin Ma
2016-09-26  7:06 ` Paolo Bonzini [this message]
2016-09-26 14:25 ` Stefan Hajnoczi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7d94ae26-5eb5-5213-ce41-dd829fe9c135@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=famz@redhat.com \
    --cc=lma@suse.com \
    --cc=qemu-devel@nongnu.org \
    --cc=stefanha@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.