virtio-serial: fix virtio-serial child refcount in transports
commite77ca8b92af8a5213897331d676089e8919f383d
authorGonglei <arei.gonglei@huawei.com>
Tue, 30 Sep 2014 06:10:32 +0000 (30 14:10 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 30 Sep 2014 09:09:12 +0000 (30 11:09 +0200)
treedb147df75b79e14e4540ab3ae0837403cece9b6d
parent4f456d8025c7259c66b2b2bcec99d5c6c94d99be
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>
hw/s390x/s390-virtio-bus.c
hw/s390x/virtio-ccw.c
hw/virtio/virtio-pci.c