From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:35498) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpCq4-00084n-Dk for qemu-devel@nongnu.org; Thu, 12 Jul 2012 02:25:28 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SpCpy-0006bQ-AQ for qemu-devel@nongnu.org; Thu, 12 Jul 2012 02:25:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:22696) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SpCpy-0006bL-0R for qemu-devel@nongnu.org; Thu, 12 Jul 2012 02:25:18 -0400 Message-ID: <4FFE6DCA.6020107@redhat.com> Date: Thu, 12 Jul 2012 08:25:14 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <1342052378-18900-1-git-send-email-ronniesahlberg@gmail.com> <1342052378-18900-2-git-send-email-ronniesahlberg@gmail.com> In-Reply-To: <1342052378-18900-2-git-send-email-ronniesahlberg@gmail.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] SCSI: rd/wr/vr-protect !=0 is an error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Ronnie Sahlberg Cc: qemu-devel@nongnu.org Il 12/07/2012 02:19, Ronnie Sahlberg ha scritto: > The QEMU SCSI emulation does not support protection information, > so any READ/WRITE/VERIFY commands that has the protect bits set to > non-zero should fail with ILLEGAL_REQUEST/INVALID_FIELD_IN_CDB > > From SCSI SBC : > If the logical unit does not support protection information, > then the device server should 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: Ronnie Sahlberg > --- > 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 34336b1..b2f3c0c 100644 > --- a/hw/scsi-disk.c > +++ b/hw/scsi-disk.c > @@ -1555,6 +1555,9 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf) > case READ_16: > len = r->req.cmd.xfer / s->qdev.blocksize; > DPRINTF("Read (sector %" PRId64 ", count %d)\n", r->req.cmd.lba, len); > + if (r->req.cmd.buf[1] & 0xe0) { > + goto fail; > + } > if (r->req.cmd.lba > s->qdev.max_lba) { > goto illegal_lba; > } > @@ -1575,6 +1578,9 @@ static int32_t scsi_send_command(SCSIRequest *req, uint8_t *buf) > DPRINTF("Write %s(sector %" PRId64 ", count %d)\n", > (command & 0xe) == 0xe ? "And Verify " : "", > r->req.cmd.lba, len); > + if (r->req.cmd.buf[1] & 0xe0) { > + goto fail; > + } > if (r->req.cmd.lba > s->qdev.max_lba) { > goto illegal_lba; > } > Applied, thanks! Paolo