From: Jia-Shiun Li <jsli@synology.com>
To: mst@redhat.com
Cc: qemu-devel@nongnu.org, Jia-Shiun Li <jsli@synology.com>
Subject: [Qemu-devel] [PATCH] vhost: Fix use-after-free in vhost_log_put()
Date: Fri, 23 Jun 2017 11:09:57 +0800 [thread overview]
Message-ID: <1498187397-127781-1-git-send-email-jsli@synology.com> (raw)
In commit 9e0bc24f dev->log_size was reset to zero too early before
syncing vhost log. It causes syncing to be skipped.
Move it to clear dev->log* after use.
Signed-off-by: Jia-Shiun Li <jsli@synology.com>
---
hw/virtio/vhost.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index 6eddb09..c9ddf11 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -375,8 +375,6 @@ static void vhost_log_put(struct vhost_dev *dev, bool sync)
if (!log) {
return;
}
- dev->log = NULL;
- dev->log_size = 0;
--log->refcnt;
if (log->refcnt == 0) {
@@ -396,6 +394,8 @@ static void vhost_log_put(struct vhost_dev *dev, bool sync)
g_free(log);
}
+ dev->log = NULL;
+ dev->log_size = 0;
}
static bool vhost_dev_log_is_shared(struct vhost_dev *dev)
--
2.7.4
next reply other threads:[~2017-06-23 3:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-06-23 3:09 Jia-Shiun Li [this message]
2017-06-28 21:11 ` [Qemu-devel] [PATCH] vhost: Fix use-after-free in vhost_log_put() Marc-André Lureau
2017-06-30 11:02 ` jsli
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=1498187397-127781-1-git-send-email-jsli@synology.com \
--to=jsli@synology.com \
--cc=mst@redhat.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).