virtio-pci: fix wrong index in virtio_pci_queue_enabled
authorYuri Benditovich <yuri.benditovich@daynix.com>
Mon, 27 Jul 2020 14:38:07 +0000 (17:38 +0300)
committerJason Wang <jasowang@redhat.com>
Tue, 28 Jul 2020 08:54:46 +0000 (16:54 +0800)
We should use the index passed by the caller instead of the queue_sel
when checking the enablement of a specific virtqueue.

This is reported in https://bugzilla.redhat.com/show_bug.cgi?id=1702608

Fixes: f19bcdfedd53 ("virtio-pci: implement queue_enabled method")
Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
hw/virtio/virtio-pci.c

index 4ad3ad81a2cfa456c8e719a362298895f691b018..ccdf54e81c7873bb93136f4368e24171ffaa21f6 100644 (file)
@@ -1113,7 +1113,7 @@ static bool virtio_pci_queue_enabled(DeviceState *d, int n)
     VirtIODevice *vdev = virtio_bus_get_device(&proxy->bus);
 
     if (virtio_vdev_has_feature(vdev, VIRTIO_F_VERSION_1)) {
-        return proxy->vqs[vdev->queue_sel].enabled;
+        return proxy->vqs[n].enabled;
     }
 
     return virtio_queue_enabled_legacy(vdev, n);