提交 8f3d60e5 编写于 作者: G Gonglei 提交者: Paolo Bonzini

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: NGonglei <arei.gonglei@huawei.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
上级 48833071
......@@ -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 = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册