thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 8 months ago
Clone

Blame SOURCES/kvm-vdpa-Fix-bad-index-calculus-at-vhost_vdpa_get_vring_.patch

29b115
From e19adb058502e24580dbc4f6f944cd951ca288ed Mon Sep 17 00:00:00 2001
29b115
From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
29b115
Date: Thu, 12 May 2022 19:57:44 +0200
29b115
Subject: [PATCH 08/11] vdpa: Fix bad index calculus at
29b115
 vhost_vdpa_get_vring_base
29b115
MIME-Version: 1.0
29b115
Content-Type: text/plain; charset=UTF-8
29b115
Content-Transfer-Encoding: 8bit
29b115
29b115
RH-Author: Eugenio Pérez <eperezma@redhat.com>
29b115
RH-MergeRequest: 114: vdpa: Fix memory listener deletions of iova tree
29b115
RH-Commit: [1/4] 754fb8960684fa7a91bddb18c8df58c3b947ee75 (eperezmartin/qemu-kvm)
29b115
RH-Bugzilla: 2116876
29b115
RH-Acked-by: Jason Wang <jasowang@redhat.com>
29b115
RH-Acked-by: Cindy Lu <lulu@redhat.com>
29b115
RH-Acked-by: Laurent Vivier <lvivier@redhat.com>
29b115
29b115
Fixes: 6d0b222666 ("vdpa: Adapt vhost_vdpa_get_vring_base to SVQ")
29b115
29b115
Acked-by: Jason Wang <jasowang@redhat.com>
29b115
Signed-off-by: Eugenio Pérez <eperezma@redhat.com>
29b115
Message-Id: <20220512175747.142058-4-eperezma@redhat.com>
29b115
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
29b115
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
29b115
(cherry picked from commit 639036477ef890958415967e753ca2cbb348c16c)
29b115
---
29b115
 hw/virtio/vhost-vdpa.c | 4 ++--
29b115
 1 file changed, 2 insertions(+), 2 deletions(-)
29b115
29b115
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
29b115
index e3e5bce4bb..a7dfac530f 100644
29b115
--- a/hw/virtio/vhost-vdpa.c
29b115
+++ b/hw/virtio/vhost-vdpa.c
29b115
@@ -1193,11 +1193,11 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
29b115
                                        struct vhost_vring_state *ring)
29b115
 {
29b115
     struct vhost_vdpa *v = dev->opaque;
29b115
+    int vdpa_idx = ring->index - dev->vq_index;
29b115
     int ret;
29b115
 
29b115
     if (v->shadow_vqs_enabled) {
29b115
-        VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs,
29b115
-                                                      ring->index);
29b115
+        VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx);
29b115
 
29b115
         /*
29b115
          * Setting base as last used idx, so destination will see as available
29b115
-- 
29b115
2.31.1
29b115