aboutsummaryrefslogtreecommitdiff
path: root/include/hw/virtio
diff options
context:
space:
mode:
authorXueming Li <xuemingl@nvidia.com>2022-02-07 15:19:29 +0800
committerMichael S. Tsirkin <mst@redhat.com>2022-03-04 08:30:52 -0500
commit0b0af4d62f7002b31cd7b2762b26d2fcb76bb2ba (patch)
tree7447197ae56a8a4a7504637571776958dd6d66dc /include/hw/virtio
parente867144b73b3c5009266b6df07d5ff44acfb82c3 (diff)
downloadqemu-0b0af4d62f7002b31cd7b2762b26d2fcb76bb2ba.zip
qemu-0b0af4d62f7002b31cd7b2762b26d2fcb76bb2ba.tar.gz
qemu-0b0af4d62f7002b31cd7b2762b26d2fcb76bb2ba.tar.bz2
vhost-user: fix VirtQ notifier cleanup
When vhost-user device cleanup, remove notifier MR and munmaps notifier address in the event-handling thread, VM CPU thread writing the notifier in concurrent fails with an error of accessing invalid address. It happens because MR is still being referenced and accessed in another thread while the underlying notifier mmap address is being freed and becomes invalid. This patch calls RCU and munmap notifiers in the callback after the memory flatview update finish. Fixes: 44866521bd6e ("vhost-user: support registering external host notifiers") Cc: qemu-stable@nongnu.org Signed-off-by: Xueming Li <xuemingl@nvidia.com> Message-Id: <20220207071929.527149-3-xuemingl@nvidia.com> Reviewed-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'include/hw/virtio')
-rw-r--r--include/hw/virtio/vhost-user.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/hw/virtio/vhost-user.h b/include/hw/virtio/vhost-user.h
index f6012b2..e44a41b 100644
--- a/include/hw/virtio/vhost-user.h
+++ b/include/hw/virtio/vhost-user.h
@@ -12,8 +12,10 @@
#include "hw/virtio/virtio.h"
typedef struct VhostUserHostNotifier {
+ struct rcu_head rcu;
MemoryRegion mr;
void *addr;
+ void *unmap_addr;
} VhostUserHostNotifier;
typedef struct VhostUserState {