All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hw/display/virtio-gpu: Unmap DMA regions on reset
@ 2026-08-03  8:21 Bin Guo
  2026-08-03  9:29 ` Akihiko Odaki
  0 siblings, 1 reply; 2+ messages in thread
From: Bin Guo @ 2026-08-03  8:21 UTC (permalink / raw)
  To: qemu-devel
  Cc: Alex Bennée, Akihiko Odaki, Dmitry Osipenko,
	Michael S . Tsirkin, qemu-stable

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
Cc: qemu-stable@nongnu.org
Signed-off-by: Bin Guo <guobin@linux.alibaba.com>
---
 hw/display/virtio-gpu.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/display/virtio-gpu.c b/hw/display/virtio-gpu.c
index 4d46a4eb10..96c0d15930 100644
--- a/hw/display/virtio-gpu.c
+++ b/hw/display/virtio-gpu.c
@@ -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);
     }
-- 
2.50.1 (Apple Git-155)



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] hw/display/virtio-gpu: Unmap DMA regions on reset
  2026-08-03  8:21 [PATCH] hw/display/virtio-gpu: Unmap DMA regions on reset Bin Guo
@ 2026-08-03  9:29 ` Akihiko Odaki
  0 siblings, 0 replies; 2+ messages in thread
From: Akihiko Odaki @ 2026-08-03  9:29 UTC (permalink / raw)
  To: Bin Guo, qemu-devel
  Cc: Alex Bennée, Dmitry Osipenko, Michael S . Tsirkin,
	qemu-stable

On 2026/08/03 17:21, Bin Guo wrote:
> 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
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Bin Guo <guobin@linux.alibaba.com>

Reviewed-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>

Regards,
Akihiko Odaki


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-08-03  9:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-03  8:21 [PATCH] hw/display/virtio-gpu: Unmap DMA regions on reset Bin Guo
2026-08-03  9:29 ` Akihiko Odaki

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.