From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60363) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9Gzv-00043W-Ka for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:36:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Y9Gzj-0006i4-1x for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:35:51 -0500 Received: from e38.co.us.ibm.com ([32.97.110.159]:53108) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Y9Gzi-0006hH-Kp for qemu-devel@nongnu.org; Thu, 08 Jan 2015 12:35:38 -0500 Received: from /spool/local by e38.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 8 Jan 2015 10:35:38 -0700 From: Michael Roth Date: Thu, 8 Jan 2015 11:33:44 -0600 Message-Id: <1420738472-23267-41-git-send-email-mdroth@linux.vnet.ibm.com> In-Reply-To: <1420738472-23267-1-git-send-email-mdroth@linux.vnet.ibm.com> References: <1420738472-23267-1-git-send-email-mdroth@linux.vnet.ibm.com> Subject: [Qemu-devel] [PATCH 40/88] virtio-9p: fix virtio-9p child refcount in transports List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: qemu-stable@nongnu.org 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 unplug the virtio-9p child is not finalized! Drop our reference after the child property has been added to the parent. Signed-off-by: Gonglei Cc: qemu-stable@nongnu.org Signed-off-by: Paolo Bonzini (cherry picked from commit 8f3d60e568f53cb3ccdedd917f8e49cdb304973b) Signed-off-by: Michael Roth --- 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 50ef68c..ba675fe 100644 --- a/hw/virtio/virtio-pci.c +++ b/hw/virtio/virtio-pci.c @@ -948,6 +948,7 @@ static void virtio_9p_pci_instance_init(Object *obj) object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_9P); object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL); qdev_alias_all_properties(DEVICE(&dev->vdev), obj); + object_unref(OBJECT(&dev->vdev)); } static const TypeInfo virtio_9p_pci_info = { -- 1.9.1