qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
To: qemu-devel@nongnu.org
Cc: zhangyuwei.9149@bytedance.com
Subject: [PATCH] hw/virtio: fix crash on kill then start vhost backend
Date: Mon, 30 Aug 2021 20:08:18 +0800	[thread overview]
Message-ID: <20210830120818.40489-1-zhangyuwei.9149@bytedance.com> (raw)

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

Signed-off-by: Yuwei Zhang <zhangyuwei.9149@bytedance.com>
---
 hw/virtio/vhost-user.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/hw/virtio/vhost-user.c b/hw/virtio/vhost-user.c
index 2407836fac..b6e76985b7 100644
--- a/hw/virtio/vhost-user.c
+++ b/hw/virtio/vhost-user.c
@@ -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;
 }
 
-- 
2.11.0



                 reply	other threads:[~2021-08-30 13:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210830120818.40489-1-zhangyuwei.9149@bytedance.com \
    --to=zhangyuwei.9149@bytedance.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).