qemu/host-vdpa-make-notifiers-_init-_uninit-symmetric.patch
Jiabo Feng c4dab45526 QEMU update to version 6.2.0-76(master)
- qga/win32: Use rundll for VSS installation
- qga/win32: Remove change action from MSI installer
- ide: Increment BB in-flight counter for TRIM BH
- hw/pci-bridge/pxb: Fix missing swizzle
- host-vdpa: make notifiers _init()/_uninit() symmetric
- hw/virtio: vdpa: Fix leak of host-notifier memory-region
- accel/tcg/cpu-exec: Fix precise single-stepping after interrupt
- Allow setting up to 8 bytes with the generic loader
- hw/net/virtio-net: make some VirtIONet const
- accel/tcg: Optimize jump cache flush during tlb range flush
- 9pfs: prevent opening special files (CVE-2023-2861)
- tcg: Reduce tcg_assert_listed_vecop() scope
- gitlab: Disable plugins for cross-i386-tci
- vfio/pci: Fix a segfault in vfio_realize
- block/iscsi: fix double-free on BUSY or similar statuses
- tests/tcg: fix unused variable in linux-test
- hw/net/vmxnet3: allow VMXNET3_MAX_MTU itself as a value
- qga/vss-win32: fix warning for clang++-15
- vnc: avoid underflow when accessing user-provided address
- block/monitor: Fix crash when executing HMP commit
- virtio-gpu: add a FIXME for virtio_gpu_load()
- hw/ppc/Kconfig: MAC_NEWWORLD should always select USB_OHCI_PCI
- migration: report compress thread pid to libvirt

Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
2023-08-07 16:46:33 +08:00

80 lines
2.4 KiB
Diff

From 8bba9208da0aa994b91d9568b58241e94b5d46fc Mon Sep 17 00:00:00 2001
From: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
Date: Wed, 26 Jul 2023 02:21:47 +0000
Subject: [PATCH] host-vdpa: make notifiers _init()/_uninit() symmetric
mainline inclusion commit b1f030a0a2e281193b09350c0281c0084e84bcf4 category:
bugfix
---------------------------------------------------------------
vhost_vdpa_host_notifiers_init() initializes queue notifiers
for queues "dev->vq_index" to queue "dev->vq_index + dev->nvqs",
whereas vhost_vdpa_host_notifiers_uninit() uninitializes the
same notifiers for queue "0" to queue "dev->nvqs".
This asymmetry seems buggy, fix that by using dev->vq_index
as the base for both.
Fixes: d0416d487bd5 ("vhost-vdpa: map virtqueue notification area if possible")
Cc: jasowang@redhat.com
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
Message-Id: <20220211161309.1385839-1-lvivier@redhat.com>
Acked-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: tangbinzy <tangbin_yewu@cmss.chinamobile.com>
---
hw/virtio/vhost-vdpa.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 225c9b1730..287025ef93 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -381,15 +381,6 @@ static void vhost_vdpa_host_notifier_uninit(struct vhost_dev *dev,
}
}
-static void vhost_vdpa_host_notifiers_uninit(struct vhost_dev *dev, int n)
-{
- int i;
-
- for (i = 0; i < n; i++) {
- vhost_vdpa_host_notifier_uninit(dev, i);
- }
-}
-
static int vhost_vdpa_host_notifier_init(struct vhost_dev *dev, int queue_index)
{
size_t page_size = qemu_real_host_page_size;
@@ -429,6 +420,15 @@ err:
return -1;
}
+static void vhost_vdpa_host_notifiers_uninit(struct vhost_dev *dev, int n)
+{
+ int i;
+
+ for (i = dev->vq_index; i < dev->vq_index + n; i++) {
+ vhost_vdpa_host_notifier_uninit(dev, i);
+ }
+}
+
static void vhost_vdpa_host_notifiers_init(struct vhost_dev *dev)
{
int i;
@@ -442,7 +442,7 @@ static void vhost_vdpa_host_notifiers_init(struct vhost_dev *dev)
return;
err:
- vhost_vdpa_host_notifiers_uninit(dev, i);
+ vhost_vdpa_host_notifiers_uninit(dev, i - dev->vq_index);
return;
}
--
2.41.0.windows.1