summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGonglei <arei.gonglei@huawei.com>2014-09-30 14:10:37 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2014-09-30 11:09:59 +0200
commit8f3d60e568f53cb3ccdedd917f8e49cdb304973b (patch)
treeb30f400b4e1883b80e811fc972bb4f6cfc1ec1e5
parent48833071d955406ebeddc365a8df8b5cb12b035f (diff)
downloadqemu-8f3d60e568f53cb3ccdedd917f8e49cdb304973b.tar.gz
virtio-9p: fix virtio-9p child refcount in transports
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>
-rw-r--r--hw/virtio/virtio-pci.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/hw/virtio/virtio-pci.c b/hw/virtio/virtio-pci.c
index 714286dab6..8f3b79b03a 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -950,6 +950,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 = {