summaryrefslogtreecommitdiffstats
path: root/hw/virtio
diff options
context:
space:
mode:
authorStefan Hajnoczi2014-06-18 11:58:35 +0200
committerStefan Hajnoczi2014-07-01 09:15:02 +0200
commitc5d49db4469dfc0cc7f4c01dfb4ed4e8b96bdbcd (patch)
tree0dd5ea735cdd76d91fa4ddf8c3921cac360eb924 /hw/virtio
parentvirtio-blk: drop virtio_blk_set_conf() (diff)
downloadqemu-c5d49db4469dfc0cc7f4c01dfb4ed4e8b96bdbcd.tar.gz
qemu-c5d49db4469dfc0cc7f4c01dfb4ed4e8b96bdbcd.tar.xz
qemu-c5d49db4469dfc0cc7f4c01dfb4ed4e8b96bdbcd.zip
virtio: fix virtio-blk 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 hot unplug the virtio-blk child is not finalized! Drop our reference after the child property has been added to the parent. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com>
Diffstat (limited to 'hw/virtio')
-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 7359d8d354..d41b864fb4 100644
--- a/hw/virtio/virtio-pci.c
+++ b/hw/virtio/virtio-pci.c
@@ -1101,6 +1101,7 @@ static void virtio_blk_pci_instance_init(Object *obj)
VirtIOBlkPCI *dev = VIRTIO_BLK_PCI(obj);
object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_BLK);
object_property_add_child(obj, "virtio-backend", OBJECT(&dev->vdev), NULL);
+ object_unref(OBJECT(&dev->vdev));
qdev_alias_all_properties(DEVICE(&dev->vdev), obj);
}