https://bugzilla.redhat.com/show_bug.cgi?id=1708480
Fix leak of region reference that prevents complete
device deletion on hot unplug.

Signed-off-by: Yuri Benditovich <yuri.benditov...@daynix.com>
---
 hw/virtio/virtio.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 04716b5f6c..baadec8abc 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2340,6 +2340,11 @@ void virtio_del_queue(VirtIODevice *vdev, int n)
     vdev->vq[n].vring.num_default = 0;
     vdev->vq[n].handle_output = NULL;
     vdev->vq[n].handle_aio_output = NULL;
+    /*
+     * with vring.num = 0 the queue will be ignored
+     * in later loops of region cache reset
+     */
+    virtio_virtqueue_reset_region_cache(&vdev->vq[n]);
     g_free(vdev->vq[n].used_elems);
 }
 
-- 
2.17.1


Reply via email to