From patchwork Thu Jul 12 00:19:38 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: ronnie sahlberg X-Patchwork-Id: 170535 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E9F1E2C0200 for ; Thu, 12 Jul 2012 10:20:13 +1000 (EST) Received: from localhost ([::1]:50752 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sp78d-0007JO-Fr for incoming@patchwork.ozlabs.org; Wed, 11 Jul 2012 20:20:11 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37350) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sp78Q-00078n-SU for qemu-devel@nongnu.org; Wed, 11 Jul 2012 20:19:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Sp78P-0004Ks-Ql for qemu-devel@nongnu.org; Wed, 11 Jul 2012 20:19:58 -0400 Received: from mail-pb0-f45.google.com ([209.85.160.45]:50928) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Sp78P-0004KL-G5 for qemu-devel@nongnu.org; Wed, 11 Jul 2012 20:19:57 -0400 Received: by mail-pb0-f45.google.com with SMTP id ro12so2944755pbb.4 for ; Wed, 11 Jul 2012 17:19:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=3ntN2Pyj5wqPW4/ApvDs6f6+dt8ufOl/yHk88vIaRwI=; b=lxayD6WD6jS/7aPOFnp5CsZTe/fJlIFmTNkpS6GuRwBKmeRdUN9CHiAbVSmw4kK5Vj 71yapy9MA3m6uzq1mWKbyj1ik41it1DuKSz/tvvq+cjua3ISQltrnPwiizFPVY9tt0Xn cyqFrVV61j86aVGEP8rihcjBTN4tLSvHJIyK91IxWHbaiHKVNsdLdTPWPDyt1neoaXcm 22S8gldXDeKPj939wbd5WzY2MYjBtGilPhmGZU6qHTD6LLmKjb42FU3kGp8tPgKUzcgs kPTsJjnilrwlRPzgfxGIONV07uTly51RlTo88Ml2eAKeadWd6ScWlzXAdQDmptroVYOX DY8w== Received: by 10.68.238.68 with SMTP id vi4mr408969pbc.123.1342052397187; Wed, 11 Jul 2012 17:19:57 -0700 (PDT) Received: from ronniesahlberg@gmail.com (ibmaus65.lnk.telstra.net. [165.228.126.9]) by mx.google.com with ESMTPS id oo6sm2649885pbc.22.2012.07.11.17.19.54 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 Jul 2012 17:19:56 -0700 (PDT) Received: by ronniesahlberg@gmail.com (sSMTP sendmail emulation); Thu, 12 Jul 2012 10:19:53 +1000 From: Ronnie Sahlberg To: pbonzini@redhat.com, qemu-devel@nongnu.org Date: Thu, 12 Jul 2012 10:19:38 +1000 Message-Id: <1342052378-18900-2-git-send-email-ronniesahlberg@gmail.com> X-Mailer: git-send-email 1.7.3.1 In-Reply-To: <1342052378-18900-1-git-send-email-ronniesahlberg@gmail.com> References: <1342052378-18900-1-git-send-email-ronniesahlberg@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.45 Cc: Ronnie Sahlberg Subject: [Qemu-devel] [PATCH] SCSI: rd/wr/vr-protect !=0 is an error X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org 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; }