qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Alexey Zaytsev <alexey.zaytsev@gmail.com>
To: qemu-devel@nongnu.org
Cc: Kevin Wolf <kwolf@redhat.com>,
	Alexey Zaytsev <alexey.zaytsev@gmail.com>,
	Stefan Hajnoczi <stefanha@redhat.com>
Subject: [Qemu-devel] [PATCH] virtio-blk: Return UNSUPP for unknown request types
Date: Thu, 13 Dec 2012 08:49:26 +0200	[thread overview]
Message-ID: <1355381366-25979-1-git-send-email-alexey.zaytsev@gmail.com> (raw)

Currently, all unknown requests are treated as VIRTIO_BLK_T_IN

Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
---
 hw/virtio-blk.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index e25cc96..1f59a76 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -392,10 +392,14 @@ static void virtio_blk_handle_request(VirtIOBlockReq *req,
         qemu_iovec_init_external(&req->qiov, &req->elem.out_sg[1],
                                  req->elem.out_num - 1);
         virtio_blk_handle_write(req, mrb);
-    } else {
+    } else if (type == VIRTIO_BLK_T_IN || type == VIRTIO_BLK_T_BARRIER) {
+	/* VIRTIO_BLK_T_IN is 0, so we can't just & it. */
         qemu_iovec_init_external(&req->qiov, &req->elem.in_sg[0],
                                  req->elem.in_num - 1);
         virtio_blk_handle_read(req);
+    } else {
+        virtio_blk_req_complete(req, VIRTIO_BLK_S_UNSUPP);
+        f_free(req);
     }
 }
 
-- 
1.7.10.4

             reply	other threads:[~2012-12-13  6:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-12-13  6:49 Alexey Zaytsev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-12-13  7:03 [Qemu-devel] [PATCH] virtio-blk: Return UNSUPP for unknown request types Alexey Zaytsev
2012-12-18 13:58 ` Stefan Hajnoczi

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=1355381366-25979-1-git-send-email-alexey.zaytsev@gmail.com \
    --to=alexey.zaytsev@gmail.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).