qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Tim Hardeck <thardeck@suse.de>
To: "Andreas Färber" <afaerber@suse.de>
Cc: qemu-trivial <qemu-trivial@nongnu.org>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 2/2] qemu queue: fix uninitialized removals
Date: Wed, 17 Oct 2012 23:24:17 +0200	[thread overview]
Message-ID: <1359569.y3MYGdvym5@thinktank.site> (raw)
In-Reply-To: <507EC7FF.90603@suse.de>

[-- Attachment #1: Type: text/plain, Size: 3039 bytes --]

Hi Andreas,

On Wednesday 17 October 2012 17:00:15 Andreas Färber wrote:
> Tim,
> 
> Am 14.10.2012 15:08, schrieb Tim Hardeck:
> > When calling QTAILQ_REMOVE or QLIST_REMOVE on an unitialized list
> > QEMU segfaults.
> 
> Can this be reproduced by a user today? Or is this just fixing the case
> that a developer forgot to initialize a list?
I am not sure but in this case it happened during an early VNC connection 
state failure which most likely wouldn't happen to regular users.
I triggered it while working on the VNC connection part.

The issue could most likely be also fixed in the VNC connection initialization 
process but if this changes doesn't have a relevant performance impact they 
might prevent some other/future crashes.

Regards
Tim

> 
> Regards,
> Andreas
> 
> > Check for this case specifically on item removal.
> > 
> > Signed-off-by: Tim Hardeck <thardeck@suse.de>
> > ---
> > 
> >  qemu-queue.h |    8 ++++++--
> >  1 file changed, 6 insertions(+), 2 deletions(-)
> > 
> > diff --git a/qemu-queue.h b/qemu-queue.h
> > index 9288cd8..47ed239 100644
> > --- a/qemu-queue.h
> > +++ b/qemu-queue.h
> > @@ -141,7 +141,9 @@ struct {                                              
> >                  \> 
> >          if ((elm)->field.le_next != NULL)                               \
> >          
> >                  (elm)->field.le_next->field.le_prev =                   \
> >                  
> >                      (elm)->field.le_prev;                               \
> > 
> > -        *(elm)->field.le_prev = (elm)->field.le_next;                   \
> > +        if ((elm)->field.le_prev != NULL) {                             \
> > +            *(elm)->field.le_prev = (elm)->field.le_next;               \
> > +        }                                                               \
> > 
> >  } while (/*CONSTCOND*/0)
> >  
> >  #define QLIST_FOREACH(var, head, field)                                 \
> > 
> > @@ -381,7 +383,9 @@ struct {                                              
> >                  \> 
> >                      (elm)->field.tqe_prev;                              \
> >          
> >          else                                                            \
> >          
> >                  (head)->tqh_last = (elm)->field.tqe_prev;               \
> > 
> > -        *(elm)->field.tqe_prev = (elm)->field.tqe_next;                 \
> > +        if ((elm)->field.tqe_prev != NULL) {                            \
> > +            *(elm)->field.tqe_prev = (elm)->field.tqe_next;             \
> > +        }                                                               \
> > 
> >  } while (/*CONSTCOND*/0)
> >  
> >  #define QTAILQ_FOREACH(var, head, field)                                \
-- 
SUSE LINUX Products GmbH, GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 
16746 (AG Nürnberg)
Maxfeldstr. 5, 90409 Nürnberg, Germany
T: +49 (0) 911 74053-0  F: +49 (0) 911 74053-483 http://www.suse.de/

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

  reply	other threads:[~2012-10-17 21:24 UTC|newest]

Thread overview: 11+ 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
2012-10-14 13:08 ` [Qemu-devel] [PATCH 2/2] qemu queue: fix uninitialized removals Tim Hardeck
2012-10-17 15:00   ` Andreas Färber
2012-10-17 21:24     ` Tim Hardeck [this message]
2012-10-18 10:43       ` Kevin Wolf
2012-10-18 13:24         ` Andreas Färber
2012-10-18 13:32         ` Peter Maydell
2012-10-18 13:48   ` Peter Maydell
  -- strict thread matches above, loose matches on Subject: below --
2012-10-09 15:21 [Qemu-devel] [PATCH 0/2] fix segfaults triggered by failed vnc handshakes Tim Hardeck
2012-10-09 15:21 ` [Qemu-devel] [PATCH 2/2] qemu queue: fix uninitialized removals Tim Hardeck

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=1359569.y3MYGdvym5@thinktank.site \
    --to=thardeck@suse.de \
    --cc=afaerber@suse.de \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@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).