qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Marc-André Lureau" <mlureau@redhat.com>
To: Li Qiang <liq3ea@gmail.com>
Cc: pbonzini@redhat.com,
	marcandre lureau <marcandre.lureau@redhat.com>,
	qemu-devel@nongnu.org, Li Qiang <liqiang6-s@360.cn>
Subject: Re: [Qemu-devel] [PATCH v2] spice-char: fix segfault in char_spice_finalize
Date: Tue, 21 Feb 2017 03:32:04 -0500 (EST)	[thread overview]
Message-ID: <910332417.8403823.1487665924940.JavaMail.zimbra@redhat.com> (raw)
In-Reply-To: <1487665107-88004-1-git-send-email-liqiang6-s@360.cn>

Hi

----- Original Message -----
> In 'qemu_chr_open_spice_vmc' if the 'psubtype' is NULL, it will
> call 'char_spice_finalize'. But as the SpiceChardev is not inserted
> in the 'spice_chars' list, the 'QLIST_REMOVE' will cause a segfault.
> Add a detect to avoid it.
> 
> Signed-off-by: Li Qiang <liqiang6-s@360.cn>

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>

> ---
>  spice-qemu-char.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/spice-qemu-char.c b/spice-qemu-char.c
> index 6f46f46..4d1c76e 100644
> --- a/spice-qemu-char.c
> +++ b/spice-qemu-char.c
> @@ -215,7 +215,10 @@ static void char_spice_finalize(Object *obj)
>      SpiceChardev *s = SPICE_CHARDEV(obj);
>  
>      vmc_unregister_interface(s);
> -    QLIST_REMOVE(s, next);
> +
> +    if (s->next.le_prev) {
> +        QLIST_REMOVE(s, next);
> +    }
>  
>      g_free((char *)s->sin.subtype);
>  #if SPICE_SERVER_VERSION >= 0x000c02
> --
> 1.8.3.1
> 
> 

  reply	other threads:[~2017-02-21  8:32 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-21  8:18 [Qemu-devel] [PATCH v2] spice-char: fix segfault in char_spice_finalize Li Qiang
2017-02-21  8:32 ` Marc-André Lureau [this message]
2017-03-02 10:20   ` Li Qiang
2017-03-02 10:25     ` Paolo Bonzini

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=910332417.8403823.1487665924940.JavaMail.zimbra@redhat.com \
    --to=mlureau@redhat.com \
    --cc=liq3ea@gmail.com \
    --cc=liqiang6-s@360.cn \
    --cc=marcandre.lureau@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).