[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v2 20/33] scsi-disk: fail READ CAPACITY if LBA != 0
From: |
Paolo Bonzini |
Subject: |
[Qemu-devel] [PATCH v2 20/33] scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0 |
Date: |
Tue, 25 Oct 2011 12:40:28 +0200 |
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>
---
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 a64b4f0..98881c6 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
- [Qemu-devel] [PATCH v2 10/33] atapi/scsi-disk: make mode page values coherent between the two, (continued)
- [Qemu-devel] [PATCH v2 10/33] atapi/scsi-disk: make mode page values coherent between the two, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 32/33] scsi: export scsi_generic_reqops, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 24/33] scsi-generic: check ioctl statuses when SG_IO succeeds, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 30/33] scsi: move max_lba to SCSIDevice, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 22/33] scsi-generic: drop SCSIGenericState, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 11/33] scsi-disk: support DVD profile in GET CONFIGURATION, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 19/33] scsi: add channel to addressing, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 31/33] scsi: make reqops const, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 28/33] scsi-disk: remove cluster_size, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 29/33] scsi-disk: small clean up to INQUIRY, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 20/33] scsi-disk: fail READ CAPACITY if LBA != 0 but PMI == 0,
Paolo Bonzini <=
- [Qemu-devel] [PATCH v2 23/33] scsi-generic: remove scsi_req_fixup, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 33/33] scsi: pass cdb to alloc_req, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 27/33] scsi-disk: do not duplicate BlockDriverState member, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 26/33] scsi-generic: snoop READ CAPACITY commands to get block size, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 25/33] scsi-generic: look at host status, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 21/33] scsi-disk: fix retrying a flush, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 16/33] scsi: remove devs array from SCSIBus, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 15/33] qdev: switch children device list to QTAILQ, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 18/33] scsi: allow arbitrary LUNs, Paolo Bonzini, 2011/10/25
- [Qemu-devel] [PATCH v2 14/33] scsi: move tcq/ndev to SCSIBusOps (now SCSIBusInfo), Paolo Bonzini, 2011/10/25