hw/display/virtio-gpu: Unmap DMA regions on reset
PATCH 1/1 hw/display/virtio-gpu: Unmap DMA regions on reset
virtio_gpu_reset() freed in-flight commands without unmapping the DMA regions acquired by virtqueue_pop(). Call virtqueue_detach_element() before g_free() in both drain loops.
Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3467
Signed-off-by Bin Guo <[email protected]>
--- hw/display/virtio-gpu.c | 2 ++ 1 file changed, 2 insertions(+)
hw/display/virtio-gpu.c +2 -0
@@ -1687,12 +1687,14 @@ void virtio_gpu_reset(VirtIODevice *vdev)while (!QTAILQ_EMPTY (&g->cmdq)) { cmd =QTAILQ_FIRST (&g->cmdq);QTAILQ_REMOVE (&g->cmdq, cmd, next); +virtqueue_detach_element (cmd->vq, &cmd->elem,0 );g_free (cmd); }while (!QTAILQ_EMPTY (&g->fenceq)) { cmd =QTAILQ_FIRST (&g->fenceq);QTAILQ_REMOVE (&g->fenceq, cmd, next); +virtqueue_detach_element (cmd->vq, &cmd->elem,0 ); g->inflight--;g_free (cmd); }
Signature · 1 line
2.50.1 (Apple Git-155)
Quoted 7 lines · Bin Guo
virtio_gpu_reset()freed in-flight commands without unmapping the DMA regions acquired byvirtqueue_pop(). Callvirtqueue_detach_element()beforeg_free()in both drain loops.Resolves: https://gitlab.com/qemu-project/qemu/-/work_items/3467
Signed-off-by Bin Guo <[email protected]>
Reviewed-by Akihiko Odaki <[email protected]>
Regards,
Akihiko Odaki