]> Git Repo - qemu.git/commitdiff
virtio-blk: Check return value of blk_aio_ioctl
authorFam Zheng <[email protected]>
Tue, 17 Feb 2015 09:55:53 +0000 (17:55 +0800)
committerKevin Wolf <[email protected]>
Tue, 10 Mar 2015 13:01:45 +0000 (14:01 +0100)
Since commit 1dc936aa84 (virtio-blk: Use blk_aio_ioctl) we silently lose
the request if blk_aio_ioctl returns NULL (not implemented).

Fix it by directly returning VIRTIO_BLK_S_UNSUPP as we used to do.

Signed-off-by: Fam Zheng <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
[ kwolf: Fixed build error on win32 ]

Signed-off-by: Kevin Wolf <[email protected]>
hw/block/virtio-blk.c

index cb71772f9567858ce13bcb9685774668089d7cbe..3ad5fe44e2adfd54726dd9d28969819d8d54592a 100644 (file)
@@ -201,6 +201,7 @@ static int virtio_blk_handle_scsi_req(VirtIOBlockReq *req)
 #ifdef __linux__
     int i;
     VirtIOBlockIoctlReq *ioctl_req;
+    BlockAIOCB *acb;
 #endif
 
     /*
@@ -278,8 +279,13 @@ static int virtio_blk_handle_scsi_req(VirtIOBlockReq *req)
     ioctl_req->hdr.sbp = elem->in_sg[elem->in_num - 3].iov_base;
     ioctl_req->hdr.mx_sb_len = elem->in_sg[elem->in_num - 3].iov_len;
 
-    blk_aio_ioctl(blk->blk, SG_IO, &ioctl_req->hdr,
-                  virtio_blk_ioctl_complete, ioctl_req);
+    acb = blk_aio_ioctl(blk->blk, SG_IO, &ioctl_req->hdr,
+                        virtio_blk_ioctl_complete, ioctl_req);
+    if (!acb) {
+        g_free(ioctl_req);
+        status = VIRTIO_BLK_S_UNSUPP;
+        goto fail;
+    }
     return -EINPROGRESS;
 #else
     abort();
This page took 0.028721 seconds and 4 git commands to generate.