[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 41/55] scsi-generic: check ioctl statuses when SG_IO
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 41/55] scsi-generic: check ioctl statuses when SG_IO succeeds |
Date: |
Mon, 31 Oct 2011 14:30:16 +0100 |
From: Paolo Bonzini <address@hidden>
A succeeding ioctl does not imply that the SCSI command succeeded.
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/scsi-generic.c | 8 ++++----
1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/scsi-generic.c b/hw/scsi-generic.c
index 5ef4825..c313749 100644
--- a/hw/scsi-generic.c
+++ b/hw/scsi-generic.c
@@ -310,9 +310,9 @@ static int get_blocksize(BlockDriverState *bdrv)
io_header.timeout = 6000; /* XXX */
ret = bdrv_ioctl(bdrv, SG_IO, &io_header);
- if (ret < 0)
+ if (ret < 0 || io_header.driver_status || io_header.host_status) {
return -1;
-
+ }
return (buf[4] << 24) | (buf[5] << 16) | (buf[6] << 8) | buf[7];
}
@@ -341,9 +341,9 @@ static int get_stream_blocksize(BlockDriverState *bdrv)
io_header.timeout = 6000; /* XXX */
ret = bdrv_ioctl(bdrv, SG_IO, &io_header);
- if (ret < 0)
+ if (ret < 0 || io_header.driver_status || io_header.host_status) {
return -1;
-
+ }
return (buf[9] << 16) | (buf[10] << 8) | buf[11];
}
--
1.7.6.4
- [Qemu-devel] [PATCH 25/55] scsi-disk: add stubs for more MMC commands, (continued)
- [Qemu-devel] [PATCH 25/55] scsi-disk: add stubs for more MMC commands, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 43/55] scsi-generic: snoop READ CAPACITY commands to get block size, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 32/55] qdev: switch children device list to QTAILQ, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 19/55] atapi/scsi: unify definitions for MMC, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 26/55] scsi-disk: store valid mode pages in a table, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 39/55] scsi-generic: drop SCSIGenericState, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 24/55] scsi-disk: fix coding style issues (braces), Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 31/55] scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo), Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 34/55] scsi: implement REPORT LUNS for arbitrary LUNs, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 55/55] scsi-disk: add scsi-block for device passthrough, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 41/55] scsi-generic: check ioctl statuses when SG_IO succeeds,
Kevin Wolf <=
- [Qemu-devel] [PATCH 40/55] scsi-generic: remove scsi_req_fixup, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 22/55] scsi: notify the device when unit attention is reported, Kevin Wolf, 2011/10/31
- Re: [Qemu-devel] [PULL 00/55] Block patches, Anthony Liguori, 2011/10/31