libqos/virtio.c: Correct 'flags' reading in qvirtqueue_kick
authorZheyu Ma <zheyuma97@gmail.com>
Wed, 20 Mar 2024 09:04:42 +0000 (10:04 +0100)
committerThomas Huth <thuth@redhat.com>
Mon, 25 Mar 2024 14:05:59 +0000 (15:05 +0100)
In qvirtqueue_kick(), the 'flags' were previously being incorrectly read from
vq->avail instead of the correct vq->used location. This update ensures 'flags'
are read from the correct location as per the virtio standard.

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-ID: <20240320090442.267525-1-zheyuma97@gmail.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
tests/qtest/libqos/virtio.c

index 82a6e122bf1c43ada87c18da985edf5a1f558547..a21b6eee9cd637ef2ae0b49fe1402a7058fafdde 100644 (file)
@@ -394,7 +394,7 @@ void qvirtqueue_kick(QTestState *qts, QVirtioDevice *d, QVirtQueue *vq,
     qvirtio_writew(d, qts, vq->avail + 2, idx + 1);
 
     /* Must read after idx is updated */
-    flags = qvirtio_readw(d, qts, vq->avail);
+    flags = qvirtio_readw(d, qts, vq->used);
     avail_event = qvirtio_readw(d, qts, vq->used + 4 +
                                 sizeof(struct vring_used_elem) * vq->size);