All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] target: do not overwrite CDB byte 1
@ 2019-10-14 18:29 Bodo Stroesser
  2019-10-14 21:51 ` Bart Van Assche
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Bodo Stroesser @ 2019-10-14 18:29 UTC (permalink / raw)
  To: target-devel

passthrough_parse_cdb() - used by TCMU and PSCSI - attepts to
reset the LUN field of SCSI-2 CDBs (bits 5,6,7 of byte 1).
The current code is wrong, as for newer commands not having the
LUN field it overwrites relevant command bits (e.g. for SECURITY
PROTOCOL IN / OUT)
We think this code was unnecessary from the beginning or at least
it is no longer useful. So we remove it entirely.

Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
---
  drivers/target/target_core_device.c |   21 ---------------------
  1 file changed, 21 deletions(-)

--- a/drivers/target/target_core_device.c
+++ b/drivers/target/target_core_device.c
@@ -1075,27 +1075,6 @@ passthrough_parse_cdb(struct se_cmd *cmd
  	unsigned int size;
   	/*
-	 * Clear a lun set in the cdb if the initiator talking to use spoke
-	 * and old standards version, as we can't assume the underlying device
-	 * won't choke up on it.
-	 */
-	switch (cdb[0]) {
-	case READ_10: /* SBC - RDProtect */
-	case READ_12: /* SBC - RDProtect */
-	case READ_16: /* SBC - RDProtect */
-	case SEND_DIAGNOSTIC: /* SPC - SELF-TEST Code */
-	case VERIFY: /* SBC - VRProtect */
-	case VERIFY_16: /* SBC - VRProtect */
-	case WRITE_VERIFY: /* SBC - VRProtect */
-	case WRITE_VERIFY_12: /* SBC - VRProtect */
-	case MAINTENANCE_IN: /* SPC - Parameter Data Format for SA RTPG */
-		break;
-	default:
-		cdb[1] &= 0x1f; /* clear logical unit number */
-		break;
-	}
-
-	/*
  	 * For REPORT LUNS we always need to emulate the response, for everything
  	 * else, pass it up.
  	 */

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target: do not overwrite CDB byte 1
  2019-10-14 18:29 [PATCH] target: do not overwrite CDB byte 1 Bodo Stroesser
@ 2019-10-14 21:51 ` Bart Van Assche
  2019-10-15  5:59 ` Hannes Reinecke
  2019-10-18  1:41 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Bart Van Assche @ 2019-10-14 21:51 UTC (permalink / raw)
  To: target-devel

On 10/14/19 11:29 AM, Bodo Stroesser wrote:
> passthrough_parse_cdb() - used by TCMU and PSCSI - attepts to
> reset the LUN field of SCSI-2 CDBs (bits 5,6,7 of byte 1).
> The current code is wrong, as for newer commands not having the
> LUN field it overwrites relevant command bits (e.g. for SECURITY
> PROTOCOL IN / OUT)
> We think this code was unnecessary from the beginning or at least
> it is no longer useful. So we remove it entirely.

Reviewed-by: Bart Van Assche <bvanassche@acm.org>

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target: do not overwrite CDB byte 1
  2019-10-14 18:29 [PATCH] target: do not overwrite CDB byte 1 Bodo Stroesser
  2019-10-14 21:51 ` Bart Van Assche
@ 2019-10-15  5:59 ` Hannes Reinecke
  2019-10-18  1:41 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Hannes Reinecke @ 2019-10-15  5:59 UTC (permalink / raw)
  To: target-devel

On 10/14/19 8:29 PM, Bodo Stroesser wrote:
> passthrough_parse_cdb() - used by TCMU and PSCSI - attepts to
> reset the LUN field of SCSI-2 CDBs (bits 5,6,7 of byte 1).
> The current code is wrong, as for newer commands not having the
> LUN field it overwrites relevant command bits (e.g. for SECURITY
> PROTOCOL IN / OUT)
> We think this code was unnecessary from the beginning or at least
> it is no longer useful. So we remove it entirely.
> 
> Signed-off-by: Bodo Stroesser <bstroesser@ts.fujitsu.com>
> ---
>  drivers/target/target_core_device.c |   21 ---------------------
>  1 file changed, 21 deletions(-)
> 
Reviewed-by: Hannes Reinecke <hare@suse.com>

Cheers,

Hannes
-- 
Dr. Hannes Reinecke		      Teamlead Storage & Networking
hare@suse.de			                  +49 911 74053 688
SUSE Software Solutions Germany GmbH, Maxfeldstr. 5, 90409 Nürnberg
HRB 247165 (AG München), GF: Felix Imendörffer

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] target: do not overwrite CDB byte 1
  2019-10-14 18:29 [PATCH] target: do not overwrite CDB byte 1 Bodo Stroesser
  2019-10-14 21:51 ` Bart Van Assche
  2019-10-15  5:59 ` Hannes Reinecke
@ 2019-10-18  1:41 ` Martin K. Petersen
  2 siblings, 0 replies; 4+ messages in thread
From: Martin K. Petersen @ 2019-10-18  1:41 UTC (permalink / raw)
  To: target-devel


Bodo,

> passthrough_parse_cdb() - used by TCMU and PSCSI - attepts to reset
> the LUN field of SCSI-2 CDBs (bits 5,6,7 of byte 1).  The current code
> is wrong, as for newer commands not having the LUN field it overwrites
> relevant command bits (e.g. for SECURITY PROTOCOL IN / OUT) We think
> this code was unnecessary from the beginning or at least it is no
> longer useful. So we remove it entirely.

Applied to 5.4/scsi-fixes, thanks!

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-10-18  1:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-14 18:29 [PATCH] target: do not overwrite CDB byte 1 Bodo Stroesser
2019-10-14 21:51 ` Bart Van Assche
2019-10-15  5:59 ` Hannes Reinecke
2019-10-18  1:41 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.