All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Andreas Färber" <afaerber@suse.de>
To: Tim Hardeck <thardeck@suse.de>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-trivial] [Qemu-devel] [PATCH 1/2] vnc: fix segfault due to failed handshake
Date: Wed, 17 Oct 2012 14:52:08 +0200	[thread overview]
Message-ID: <507EA9F8.7090209@suse.de> (raw)
In-Reply-To: <1350220128-10140-2-git-send-email-thardeck@suse.de>

Am 14.10.2012 15:08, schrieb Tim Hardeck:
> When the VNC server disconnects due to a failed handshake we don't have
> vs->bh allocated yet.
> 
> Check for this case and don't delete it.
> 
> Signed-off-by: Tim Hardeck <thardeck@suse.de>
> ---
>  ui/vnc.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 01b2daf..656895a 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -1055,7 +1055,9 @@ static void vnc_disconnect_finish(VncState *vs)
>      vnc_unlock_output(vs);
>  
>      qemu_mutex_destroy(&vs->output_mutex);
> -    qemu_bh_delete(vs->bh);
> +    if (vs->bh != NULL) {
> +        qemu_bh_delete(vs->bh);
> +    }
>      buffer_free(&vs->jobs_buffer);
>  
>      for (i = 0; i < VNC_STAT_ROWS; ++i) {

qemu_bh_delete() is not checking for a NULL argument, therefore this fix
looks good to me,

Acked-by: Andreas Färber <afaerber@suse.de>

Adding some CCs.

As a followup it might be a good idea to either assert or ignore a NULL
argument in qemu_bh_delete().

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg


WARNING: multiple messages have this Message-ID (diff)
From: "Andreas Färber" <afaerber@suse.de>
To: Tim Hardeck <thardeck@suse.de>
Cc: qemu-trivial <qemu-trivial@nongnu.org>,
	qemu-devel@nongnu.org, Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [PATCH 1/2] vnc: fix segfault due to failed handshake
Date: Wed, 17 Oct 2012 14:52:08 +0200	[thread overview]
Message-ID: <507EA9F8.7090209@suse.de> (raw)
In-Reply-To: <1350220128-10140-2-git-send-email-thardeck@suse.de>

Am 14.10.2012 15:08, schrieb Tim Hardeck:
> When the VNC server disconnects due to a failed handshake we don't have
> vs->bh allocated yet.
> 
> Check for this case and don't delete it.
> 
> Signed-off-by: Tim Hardeck <thardeck@suse.de>
> ---
>  ui/vnc.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/ui/vnc.c b/ui/vnc.c
> index 01b2daf..656895a 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -1055,7 +1055,9 @@ static void vnc_disconnect_finish(VncState *vs)
>      vnc_unlock_output(vs);
>  
>      qemu_mutex_destroy(&vs->output_mutex);
> -    qemu_bh_delete(vs->bh);
> +    if (vs->bh != NULL) {
> +        qemu_bh_delete(vs->bh);
> +    }
>      buffer_free(&vs->jobs_buffer);
>  
>      for (i = 0; i < VNC_STAT_ROWS; ++i) {

qemu_bh_delete() is not checking for a NULL argument, therefore this fix
looks good to me,

Acked-by: Andreas Färber <afaerber@suse.de>

Adding some CCs.

As a followup it might be a good idea to either assert or ignore a NULL
argument in qemu_bh_delete().

Regards,
Andreas

-- 
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg

  reply	other threads:[~2012-10-17 14:52 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-10-14 13:08 [Qemu-devel] [PATCH 0/2] fix segfaults triggered by failed vnc handshakes Tim Hardeck
2012-10-14 13:08 ` [Qemu-devel] [PATCH 1/2] vnc: fix segfault due to failed handshake Tim Hardeck
2012-10-17 12:52   ` Andreas Färber [this message]
2012-10-17 12:52     ` Andreas Färber
2012-10-14 13:08 ` [Qemu-devel] [PATCH 2/2] qemu queue: fix uninitialized removals Tim Hardeck
2012-10-17 15:00   ` [Qemu-trivial] " Andreas Färber
2012-10-17 15:00     ` Andreas Färber
2012-10-17 21:24     ` [Qemu-trivial] " Tim Hardeck
2012-10-17 21:24       ` Tim Hardeck
2012-10-18 10:43       ` [Qemu-trivial] " Kevin Wolf
2012-10-18 10:43         ` Kevin Wolf
2012-10-18 13:24         ` [Qemu-trivial] " Andreas Färber
2012-10-18 13:24           ` Andreas Färber
2012-10-18 13:32         ` [Qemu-trivial] " Peter Maydell
2012-10-18 13:32           ` Peter Maydell
2012-10-18 13:48   ` Peter Maydell

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=507EA9F8.7090209@suse.de \
    --to=afaerber@suse.de \
    --cc=anthony@codemonkey.ws \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    --cc=thardeck@suse.de \
    /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.