Skip to contentSkip to conversation

hw/virtio: fix crash on kill then start vhost backend

PATCH New Yuwei Zhang 1 participant 1 message Aug 30, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/virtio: fix crash on kill then start vhost backend

Add flatview update in vhost_user_cleanup() to avoid access unmapped memory which may cause a qemu crash.

---
 hw/virtio/vhost-user.c | 2 ++
 1 file changed, 2 insertions(+)
hw/virtio/vhost-user.c +2 -0
index 2407836fac..b6e76985b7 100644
@@ -2423,6 +2423,7 @@ void vhost_user_cleanup(VhostUserState *user)
         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));
@@ -2430,6 +2431,7 @@ void vhost_user_cleanup(VhostUserState *user)
             user->notifier[i].addr = NULL;
         }
     }
+    memory_region_transaction_commit();
     user->chr = NULL;
 }
 
Signature · 1 line
2.11.0