qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Cornelia Huck <cornelia.huck@de.ibm.com>
To: Alexander Graf <agraf@suse.de>
Cc: "Christian Borntraeger" <borntraeger@de.ibm.com>,
	"Jens Freimann" <jfrei@linux.vnet.ibm.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	"Andreas Färber" <afaerber@suse.de>,
	"Paolo Bonzini" <pbonzini@redhat.com>
Subject: Re: [Qemu-devel] [PATCH 1/3] virtio-ccw: remove qdev_unparent in unplug routing
Date: Mon, 11 Mar 2013 13:04:47 +0100	[thread overview]
Message-ID: <20130311130447.620e713d@gondolin> (raw)
In-Reply-To: <B70C1A7A-6271-42E1-B35A-2F38D4AC4A5B@suse.de>

On Fri, 8 Mar 2013 21:11:13 +0100
Alexander Graf <agraf@suse.de> wrote:

> 
> On 25.02.2013, at 12:10, Christian Borntraeger wrote:
> 
> > On 25/02/13 11:44, Paolo Bonzini wrote:
> >> Il 25/02/2013 09:09, Christian Borntraeger ha scritto:
> >>> Hmm, the old sequence was 
> >>> 
> >>>     object_unparent(OBJECT(dev));
> >>>     qdev_free(dev) ---+
> >>>                       |
> >>>                       V
> >>> ...
> >>> 	     object_unparent(OBJECT(dev));  now the last reference is gone, object is freed
> >>> 	     object_unref(OBJECT(dev));     now the reference of a deleted object becomes -1
> >>> ...
> >>> 
> >>> Isnt that a problem in itself that we modify a reference counter in an deleted object?
> >> 
> >> The second object_unparent should do nothing.  So before you had:
> >> 
> >>      object_unparent(OBJECT(dev));	    leaves refcount=1
> >>      qdev_free(dev) ---+
> >>                        |
> >>                        V
> >> 	     object_unparent(OBJECT(dev));  do nothing
> >> 	     object_unref(OBJECT(dev));     refcount=0, object freed
> >> 
> >> After the object_unref was removed you had:
> >> 
> >>      object_unparent(OBJECT(dev));	    refcount=0, object freed
> >>      qdev_free(dev) ---+
> >>                        |
> >>                        V
> >> 	     object_unparent(OBJECT(dev));  dangling pointer!
> >> 
> > 
> > 
> > Got it. Thanks
> 
> So is the patch valid?

To my understanding, yes.

> 
> 
> Alex
> 

  reply	other threads:[~2013-03-11 12:05 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1489845274.730285.1361778940139.JavaMail.root@redhat.com>
     [not found] ` <512B1C35.3040500@de.ibm.com>
     [not found]   ` <512B4073.6050100@redhat.com>
     [not found]     ` <512B46C3.4030805@de.ibm.com>
2013-03-08 20:11       ` [Qemu-devel] [PATCH 1/3] virtio-ccw: remove qdev_unparent in unplug routing Alexander Graf
2013-03-11 12:04         ` Cornelia Huck [this message]
2013-03-11 12:16           ` Paolo Bonzini
2013-03-11 12:22             ` Alexander Graf
2013-03-11 12:32               ` Cornelia Huck

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=20130311130447.620e713d@gondolin \
    --to=cornelia.huck@de.ibm.com \
    --cc=afaerber@suse.de \
    --cc=agraf@suse.de \
    --cc=borntraeger@de.ibm.com \
    --cc=jfrei@linux.vnet.ibm.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).