From: Li RongQing <[email protected]>

In vp_find_vqs_intx(), the admin vq was set up using the local
queue_idx counter instead of avq->vq_index (the actual queue index
obtained from the device). This differs from vp_find_vqs_msix() which
correctly uses avq->vq_index. Using the wrong index causes the admin
virtqueue to be mapped to an incorrect hardware queue.

Fix it by using avq->vq_index consistent with the msix path.

Fixes: af22bbe1f4a5 ("virtio: create admin queues alongside other virtqueues")
Signed-off-by: Li RongQing <[email protected]>
---
 drivers/virtio/virtio_pci_common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/virtio/virtio_pci_common.c 
b/drivers/virtio/virtio_pci_common.c
index 164f480..10371ec 100644
--- a/drivers/virtio/virtio_pci_common.c
+++ b/drivers/virtio/virtio_pci_common.c
@@ -499,7 +499,7 @@ static int vp_find_vqs_intx(struct virtio_device *vdev, 
unsigned int nvqs,
        if (!avq_num)
                return 0;
        sprintf(avq->name, "avq.%u", avq->vq_index);
-       vq = vp_setup_vq(vdev, queue_idx++, vp_modern_avq_done, avq->name,
+       vq = vp_setup_vq(vdev, avq->vq_index, vp_modern_avq_done, avq->name,
                         false, VIRTIO_MSI_NO_VECTOR,
                         &vp_dev->admin_vq.info);
        if (IS_ERR(vq)) {
-- 
2.9.4


Reply via email to