From: "Michael S. Tsirkin" <mst@redhat.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>, Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH RFC for-2.2] virtio-blk: force 1st s/g to match header
Date: Thu, 27 Nov 2014 18:33:33 +0200 [thread overview]
Message-ID: <1417105946-27374-1-git-send-email-mst@redhat.com> (raw)
We leak cpu mappings when 1st s/g is not exactly the
header. As we don't set ANY_LAYOUT, we can at this point
simply assert the correct length.
This will have to be fixed once ANY_LAYOUT is set.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
Untested: posting for early feedback.
hw/block/virtio-blk.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c
index b19b102..1404b3f 100644
--- a/hw/block/virtio-blk.c
+++ b/hw/block/virtio-blk.c
@@ -381,6 +381,12 @@ void virtio_blk_handle_request(VirtIOBlockReq *req, MultiReqBuffer *mrb)
exit(1);
}
+ /* We don't advertize ANY_LAYOUT, so first s/g is exactly the header. */
+ if (iov[0].iov_len != sizeof(req->out)) {
+ error_report("virtio-blk request outhdr too long");
+ exit(1);
+ }
+
iov_discard_front(&iov, &out_num, sizeof(req->out));
if (in_num < 1 ||
--
MST
next reply other threads:[~2014-11-27 16:33 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-27 16:33 Michael S. Tsirkin [this message]
2014-11-27 19:21 ` [Qemu-devel] [PATCH RFC for-2.2] virtio-blk: force 1st s/g to match header Stefan Hajnoczi
2014-11-27 21:13 ` Michael S. Tsirkin
2014-11-28 1:16 ` Fam Zheng
2014-11-28 7:05 ` Jason Wang
2014-11-28 11:43 ` Stefan Hajnoczi
2014-11-28 14:05 ` Marc Marí
2014-11-28 16:14 ` Peter Maydell
2014-11-30 16:43 ` Michael S. Tsirkin
2014-12-01 12:07 ` Peter Maydell
2014-12-01 12:18 ` Michael S. Tsirkin
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=1417105946-27374-1-git-send-email-mst@redhat.com \
--to=mst@redhat.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/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).