diff options
author | Alexey Zaytsev <alexey.zaytsev@gmail.com> | 2012-12-13 09:03:43 +0200 |
---|---|---|
committer | Stefan Hajnoczi <stefanha@redhat.com> | 2013-01-02 16:08:53 +0100 |
commit | 9e72c45033770b81b536ac6091e91807247cc25a (patch) | |
tree | 2e489fbe5551c6517a3aaabbbe0cadd94b32ea68 /hw/virtio-blk.c | |
parent | 392808b49b6aee066d0c1d200e72fc3dc11c9d0f (diff) |
virtio-blk: Return UNSUPP for unknown request types
Currently, all unknown requests are treated as VIRTIO_BLK_T_IN
Signed-off-by: Alexey Zaytsev <alexey.zaytsev@gmail.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'hw/virtio-blk.c')
-rw-r--r-- | hw/virtio-blk.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c index 92c745a316..df57b35f1b 100644 --- a/hw/virtio-blk.c +++ b/hw/virtio-blk.c @@ -398,10 +398,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); + g_free(req); } } |