summary refs log tree commit diff stats
path: root/hw/virtio/vhost-user.c
diff options
context:
space:
mode:
authorYuwei Zhang <zhangyuwei.9149@bytedance.com>2021-08-30 20:34:33 +0800
committerMichael S. Tsirkin <mst@redhat.com>2021-09-04 17:34:05 -0400
commitc6effa9cf59f0191865f2f65d8a7398abff0490f (patch)
tree133db9e1b5e4f79f4666500d4ed7458df0c63e15 /hw/virtio/vhost-user.c
parentb116d6c319661b59d0461f771f407e47f54a8c80 (diff)
downloadfocaccia-qemu-c6effa9cf59f0191865f2f65d8a7398abff0490f.tar.gz
focaccia-qemu-c6effa9cf59f0191865f2f65d8a7398abff0490f.zip
hw/virtio: Add flatview update in vhost_user_cleanup()
Qemu will crash on vhost backend unexpected exit and re-connect                                                                          │
in some case due to access released memory.

Signed-off-by: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
Message-Id: <20210830123433.45727-1-zhangyuwei.9149@bytedance.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'hw/virtio/vhost-user.c')
-rw-r--r--hw/virtio/vhost-user.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 360d9bc040..2c8556237f 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -2480,7 +2480,7 @@ void vhost_user_cleanup(VhostUserState *user)
     if (!user->chr) {
         return;
     }
-
+    memory_region_transaction_begin();
     for (i = 0; i < VIRTIO_QUEUE_MAX; i++) {
         if (user->notifier[i].addr) {
             object_unparent(OBJECT(&user->notifier[i].mr));
@@ -2488,6 +2488,7 @@ void vhost_user_cleanup(VhostUserState *user)
             user->notifier[i].addr = NULL;
         }
     }
+    memory_region_transaction_commit();
     user->chr = NULL;
 }