]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
virtio-9p: fix virtio-9p child refcount in transports
authorGonglei <arei.gonglei@huawei.com>
Tue, 30 Sep 2014 06:10:37 +0000 (14:10 +0800)
committerMichael Roth <mdroth@linux.vnet.ibm.com>
Tue, 6 Jan 2015 22:03:37 +0000 (16:03 -0600)
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 <arei.gonglei@huawei.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 8f3d60e568f53cb3ccdedd917f8e49cdb304973b)
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
hw/virtio/virtio-pci.c

index 50ef68cfa522ddba56d17c90eb2456fb9a6d8478..ba675fe9219fde2c1c5bd8ef334e25c611f820d0 100644 (file)
@@ -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 = {