diff options
author | Gonglei <arei.gonglei@huawei.com> | 2014-09-30 14:10:32 +0800 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2014-09-30 11:09:12 +0200 |
commit | e77ca8b92af8a5213897331d676089e8919f383d (patch) | |
tree | db147df75b79e14e4540ab3ae0837403cece9b6d /hw/s390x | |
parent | 4f456d8025c7259c66b2b2bcec99d5c6c94d99be (diff) |
virtio-serial: fix virtio-serial 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-serial 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>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'hw/s390x')
-rw-r--r-- | hw/s390x/s390-virtio-bus.c | 1 | ||||
-rw-r--r-- | hw/s390x/virtio-ccw.c | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/hw/s390x/s390-virtio-bus.c b/hw/s390x/s390-virtio-bus.c index 31f5286e3c..422402e564 100644 --- a/hw/s390x/s390-virtio-bus.c +++ b/hw/s390x/s390-virtio-bus.c @@ -227,6 +227,7 @@ static void s390_virtio_serial_instance_init(Object *obj) object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SERIAL); 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 int s390_virtio_scsi_init(VirtIOS390Device *s390_dev) diff --git a/hw/s390x/virtio-ccw.c b/hw/s390x/virtio-ccw.c index 271104d049..5d7f3a6af7 100644 --- a/hw/s390x/virtio-ccw.c +++ b/hw/s390x/virtio-ccw.c @@ -853,6 +853,7 @@ static void virtio_ccw_serial_instance_init(Object *obj) object_initialize(&dev->vdev, sizeof(dev->vdev), TYPE_VIRTIO_SERIAL); 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 int virtio_ccw_balloon_init(VirtioCcwDevice *ccw_dev) |