]> git.proxmox.com Git - pve-qemu.git/blob - debian/patches/extra/0016-vdpa-Fix-bad-index-calculus-at-vhost_vdpa_get_vring_.patch
bump version to 7.0.0-4
[pve-qemu.git] / debian / patches / extra / 0016-vdpa-Fix-bad-index-calculus-at-vhost_vdpa_get_vring_.patch
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Eugenio=20P=C3=A9rez?= <eperezma@redhat.com>
3 Date: Thu, 12 May 2022 19:57:44 +0200
4 Subject: [PATCH] vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Fixes: 6d0b222666 ("vdpa: Adapt vhost_vdpa_get_vring_base to SVQ")
10
11 Acked-by: Jason Wang <jasowang@redhat.com>
12 Signed-off-by: Eugenio PĂ©rez <eperezma@redhat.com>
13 Message-Id: <20220512175747.142058-4-eperezma@redhat.com>
14 Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
15 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
16 (cherry-picked from commit 639036477ef890958415967e753ca2cbb348c16c)
17 Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
18 ---
19 hw/virtio/vhost-vdpa.c | 4 ++--
20 1 file changed, 2 insertions(+), 2 deletions(-)
21
22 diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
23 index 8adf7c0b92..8555a84f87 100644
24 --- a/hw/virtio/vhost-vdpa.c
25 +++ b/hw/virtio/vhost-vdpa.c
26 @@ -1170,11 +1170,11 @@ static int vhost_vdpa_get_vring_base(struct vhost_dev *dev,
27 struct vhost_vring_state *ring)
28 {
29 struct vhost_vdpa *v = dev->opaque;
30 + int vdpa_idx = ring->index - dev->vq_index;
31 int ret;
32
33 if (v->shadow_vqs_enabled) {
34 - VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs,
35 - ring->index);
36 + VhostShadowVirtqueue *svq = g_ptr_array_index(v->shadow_vqs, vdpa_idx);
37
38 /*
39 * Setting base as last used idx, so destination will see as available