From: Paolo Bonzini <pbonzini@redhat.com>
To: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: "Christian Borntraeger" <borntraeger@de.ibm.com>,
"Jens Freimann" <jfrei@linux.vnet.ibm.com>,
"Alexander Graf" <agraf@suse.de>,
"Andreas Färber" <afaerber@suse.de>,
qemu-devel <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH 1/3] virtio-ccw: remove qdev_unparent in unplug routing
Date: Mon, 11 Mar 2013 13:16:44 +0100 [thread overview]
Message-ID: <513DCB2C.5030404@redhat.com> (raw)
In-Reply-To: <20130311130447.620e713d@gondolin>
Il 11/03/2013 13:04, Cornelia Huck ha scritto:
> 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.
Yes, except that the "fixed a crash" part in the commit message is
probably no longer accurate. No big deal. :)
Paolo
next prev parent reply other threads:[~2013-03-11 12:16 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
2013-03-11 12:16 ` Paolo Bonzini [this message]
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=513DCB2C.5030404@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=agraf@suse.de \
--cc=borntraeger@de.ibm.com \
--cc=cornelia.huck@de.ibm.com \
--cc=jfrei@linux.vnet.ibm.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).