Tomo, List Please find attached a patch for read10/12/16 that makes it return INVALID REQUEST/ILLEGAL OPERATION CODE when a non-zero RDPROTECT value is specified. RDPROTECT must be 0 when type 0 protection (==no protection) is used. regards ronnie sahlberg
Attachment:
0001-Return-correct-sense-for-reads-with-invalid-RDPROTEC.patch.gz
Description: GNU Zip compressed data
From 0c63772a0c10c812e17b1db80adcfb2d7c0b7dfb Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> Date: Sat, 16 Apr 2011 09:56:17 +1000 Subject: [PATCH] Return correct sense for reads with invalid RDPROTECT field. TGTD does not use formatting protection, i.e. it always uses 'type 0 protection'. In 'type 0 protection' any READ10/12/16 command that specifies a non-zero RDPROTECT value should be aborted with ILLEGAL REQUEST/INVALID OPERATION CODE Signed-off-by: Ronnie Sahlberg <ronniesahlberg@xxxxxxxxx> --- usr/sbc.c | 12 ++++++++++++ 1 files changed, 12 insertions(+), 0 deletions(-) diff --git a/usr/sbc.c b/usr/sbc.c index a5fb754..cb07be6 100644 --- a/usr/sbc.c +++ b/usr/sbc.c @@ -112,6 +112,18 @@ static int sbc_rw(int host_no, struct scsi_cmd *cmd) if (ret) return SAM_STAT_RESERVATION_CONFLICT; + switch (cmd->scb[0]) { + case READ_10: + case READ_12: + case READ_16: + if (cmd->scb[1] & 0xe0) { + key = ILLEGAL_REQUEST; + asc = ASC_INVALID_OP_CODE; + goto sense; + } + break; + } + if (lu->attrs.readonly) { switch (cmd->scb[0]) { case WRITE_6: -- 1.7.3.1