All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] virtio: update memory region cache when queue size changes
@ 2022-02-10 11:44 Konstantin Khlebnikov
  0 siblings, 0 replies; only message in thread
From: Konstantin Khlebnikov @ 2022-02-10 11:44 UTC (permalink / raw)
  To: qemu-devel; +Cc: yc-core

Fuzzing found that queue size could be changed after writing queue address.
Resulting cached regions might be shorter than that and cause assert later.

Let's update cached memory regions after changing queue size.
This is no-op if queue address isn't set yet.

Buglink: https://gitlab.com/qemu-project/qemu/-/issues/781
Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 hw/virtio/virtio.c |    1 +
 1 file changed, 1 insertion(+)

diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 9e8f51dfb0..cd525a0f9a 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -2245,6 +2245,7 @@ void virtio_queue_set_num(VirtIODevice *vdev, int n, int num)
         return;
     }
     vdev->vq[n].vring.num = num;
+    virtio_init_region_cache(vdev, n);
 }
 
 VirtQueue *virtio_vector_first_queue(VirtIODevice *vdev, uint16_t vector)



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-02-10 11:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10 11:44 [PATCH] virtio: update memory region cache when queue size changes Konstantin Khlebnikov

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.