Skip to contentSkip to conversation

virtio-blk: Return UNSUPP for unknown request types

PATCH Applied Alexey Zaytsev 2 participants 2 messages Dec 13, 2012 – Dec 18, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 virtio-blk: Return UNSUPP for unknown request types

Currently, all unknown requests are treated as VIRTIO_BLK_T_IN

---
Sorry, made a typo when formatting the patch, please consider this one.

 hw/virtio-blk.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
hw/virtio-blk.c +5 -1
index e25cc96..c47951a 100644
@@ -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);
+        g_free(req);
     }
 }
 
Signature · 1 line
1.7.10.4