From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:34779) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPqm1-0001QF-Sp for qemu-devel@nongnu.org; Fri, 05 Sep 2014 06:29:50 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XPqlx-0002As-2P for qemu-devel@nongnu.org; Fri, 05 Sep 2014 06:29:45 -0400 Received: from mx1.redhat.com ([209.132.183.28]:64190) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XPqlw-00028s-Rg for qemu-devel@nongnu.org; Fri, 05 Sep 2014 06:29:41 -0400 Date: Fri, 5 Sep 2014 13:32:47 +0300 From: "Michael S. Tsirkin" Message-ID: <20140905103247.GB15743@redhat.com> References: <1409830892-5056-1-git-send-email-arei.gonglei@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1409830892-5056-1-git-send-email-arei.gonglei@huawei.com> Subject: Re: [Qemu-devel] [PATCH] virtio-pci: fix virtio-net child refcount in transports List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: arei.gonglei@huawei.com Cc: weidong.huang@huawei.com, qemu-devel@nongnu.org On Thu, Sep 04, 2014 at 07:41:32PM +0800, arei.gonglei@huawei.com wrote: > From: Gonglei > > object_initialize() leaves the object with a refcount of 1. > object_property_add_child() adds its own reference which is dropped > again when the property is deleted. > > The upshot of this is that we always have a refcount >= 1. Upon hot > unplug the virtio-net child is not finalized! > > Drop our reference after the child property has been added to the > parent. > > Signed-off-by: Gonglei Aren't other virtio devices affected? what about virtio-scsi? > --- > Stefan had post virtio-blk in commit c5d49db4, but virtio-net has > the same problem. Maybe the other virtio devices have too. > --- > hw/virtio/virtio-pci.c | 1 + > 1 file changed, 1 insertion(+) > > diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c > index ddb5da1..78dcd68 100644 > --- a/hw/virtio/virtio-pci.c > +++ b/hw/virtio/virtio-pci.c > @@ -1456,6 +1456,7 @@ static void virtio_net_pci_instance_init(Object *obj) > VirtIONetPCI *dev = VIRTIO_NET_PCI(obj); > object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_NET); > object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); > + object_unref(OBJECT(&dev->vdev)); > } > > static const TypeInfo virtio_net_pci_info = { > -- > 1.7.12.4 >