[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 37/55] scsi-disk: fail READ CAPACITY if LBA != 0 but
From: |
Kevin Wolf |
Subject: |
[Qemu-devel] [PATCH 37/55] scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0 |
Date: |
Mon, 31 Oct 2011 14:30:12 +0100 |
From: Paolo Bonzini <address@hidden>
Tested by the Windows Logo Kit SCSI Compliance test. From SBC-3, paragraph
5.25: "The LOGICAL BLOCK ADDRESS field shall be set to zero if the PMI
bit is set to zero. If the PMI bit is set to zero and the LOGICAL BLOCK
ADDRESS field is not set to zero, then the device server shall terminate
the command with CHECK CONDITION status with the sense key set to ILLEGAL
REQUEST and the additional sense code set to INVALID FIELD IN CDB".
Signed-off-by: Paolo Bonzini <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/scsi-disk.c | 6 ++++++
1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/hw/scsi-disk.c b/hw/scsi-disk.c
index 50fc3d6..6b139ac 100644
--- a/hw/scsi-disk.c
+++ b/hw/scsi-disk.c
@@ -1180,6 +1180,9 @@ static int scsi_disk_emulate_command(SCSIDiskReq *r)
if (!nb_sectors) {
goto not_ready;
}
+ if ((req->cmd.buf[8] & 1) == 0 && req->cmd.lba) {
+ goto illegal_request;
+ }
nb_sectors /= s->cluster_size;
/* Returned value is the address of the last sector. */
nb_sectors--;
@@ -1232,6 +1235,9 @@ static int scsi_disk_emulate_command(SCSIDiskReq *r)
if (!nb_sectors) {
goto not_ready;
}
+ if ((req->cmd.buf[14] & 1) == 0 && req->cmd.lba) {
+ goto illegal_request;
+ }
nb_sectors /= s->cluster_size;
/* Returned value is the address of the last sector. */
nb_sectors--;
--
1.7.6.4
- [Qemu-devel] [PATCH 10/55] vmdk: Improve error handling, (continued)
- [Qemu-devel] [PATCH 10/55] vmdk: Improve error handling, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 11/55] vmdk: Fix possible segfaults, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 14/55] qemu-io: delete bs instead of leaking it, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 15/55] block: set bs->read_only before .bdrv_open(), Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 17/55] Documentation: Add syntax for using sheepdog devices, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 16/55] block: reinitialize across bdrv_close()/bdrv_open(), Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 18/55] scsi: pass correct sense code for ENOMEDIUM, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 35/55] scsi: allow arbitrary LUNs, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 33/55] scsi: remove devs array from SCSIBus, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 38/55] scsi-disk: fix retrying a flush, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 37/55] scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0,
Kevin Wolf <=
- [Qemu-devel] [PATCH 45/55] scsi-disk: remove cluster_size, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 44/55] scsi-disk: do not duplicate BlockDriverState member, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 46/55] scsi-disk: small clean up to INQUIRY, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 47/55] scsi: move max_lba to SCSIDevice, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 50/55] scsi: pass cdb to alloc_req, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 49/55] scsi: export scsi_generic_reqops, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 52/55] scsi-disk: bump SCSIRequest reference count until aio completion runs, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 51/55] scsi: do not call transfer_data after canceling a request, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 36/55] scsi: add channel to addressing, Kevin Wolf, 2011/10/31
- [Qemu-devel] [PATCH 21/55] atapi: cleanup/fix mode sense results, Kevin Wolf, 2011/10/31