Re: [Qemu-devel] [PATCH] virtio-scsi: Unset hotplug handler when unrealize

2017-05-18 Thread Paolo Bonzini
On 18/05/2017 12:28, Fam Zheng wrote: > Like suggested by Paolo, it seems to make sense to do this clean up in > bus_unparent, but given how confused I got when working on this bug, I'm > not confident in my reasoning about the ref count balance in other > callers. Queued this for now. Paolo

[Qemu-devel] [PATCH] virtio-scsi: Unset hotplug handler when unrealize

2017-05-18 Thread Fam Zheng
This matches the qbus_set_hotplug_handler in realize and is important to release the final reference to the embedded VirtIODevice so that it is properly finalized. A use-after-free is fixed with this patch, indirectly: virtio_device_instance_finalize wasn't called at hot-unplug, and the vdev->list