qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Bharata B Rao <bharata@linux.vnet.ibm.com>
To: David Gibson <david@gibson.dropbear.id.au>
Cc: Greg Kurz <groug@kaod.org>,
	qemu-devel@nongnu.org, qemu-ppc@nongnu.org,
	Alexander Graf <agraf@suse.de>
Subject: Re: [Qemu-devel] [PATCH] spapr: fix write-past-end-of-array error in cpu core device init code
Date: Tue, 28 Jun 2016 13:30:47 +0530	[thread overview]
Message-ID: <20160628080047.GG27296@in.ibm.com> (raw)
In-Reply-To: <20160628062422.GF4242@voom.fritz.box>

On Tue, Jun 28, 2016 at 04:24:22PM +1000, David Gibson wrote:
> On Tue, Jun 28, 2016 at 07:24:16AM +0200, Greg Kurz wrote:
> > On Tue, 28 Jun 2016 12:55:07 +1000
> > David Gibson <david@gibson.dropbear.id.au> wrote:
> > 
> > > On Mon, Jun 27, 2016 at 06:28:15PM +0200, Greg Kurz wrote:
> > > > This fixes a potential QEMU crash introduced by commit 3b542549661.
> > > > 
> > > > Signed-off-by: Greg Kurz <groug@kaod.org>
> > > > ---
> > > >  hw/ppc/spapr_cpu_core.c |    3 +--
> > > >  1 file changed, 1 insertion(+), 2 deletions(-)  
> > > 
> > > Ugh.  The existing code is wrong in the case where the failure happens
> > > after the loop.
> > > 
> > > But this version is wrong in the case it happens during the loop - it
> > > will fail to clean up the last object created.
> > > 
> > 
> > Hmm... unless I'm missing something, if object_property_add_child() fails to
> > add object i, we don't want to unparent it, and we should start rollback
> > at index i-1.
> 
> Good point, my mistake.  I'll apply this fix.
> 
> > 
> > Another weirdness is that I see no rollback for the object_child_foreach()
> > loop: in case of failure, we will unparent realized objects... is it
> > okay ?
> 
> Um.. I have no idea.  Bharata? Alex?

This is similar to how device_add code recovers when there is failure
during realize. So I think object_unparent() should be fine. Only other
thing I need to verify is whether an additional object_unref() is needed
after unparenting.

Regards,
Bharata.

      reply	other threads:[~2016-06-28  8:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-27 16:28 [Qemu-devel] [PATCH] spapr: fix write-past-end-of-array error in cpu core device init code Greg Kurz
2016-06-28  2:55 ` David Gibson
2016-06-28  5:24   ` Greg Kurz
2016-06-28  6:24     ` David Gibson
2016-06-28  8:00       ` Bharata B Rao [this message]

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=20160628080047.GG27296@in.ibm.com \
    --to=bharata@linux.vnet.ibm.com \
    --cc=agraf@suse.de \
    --cc=david@gibson.dropbear.id.au \
    --cc=groug@kaod.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@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).