Re: [PATCH] scsi_ioctl_send_command() shouldn't write SEND DIAGNOSTIC S reserved bits

From: Guest section DW (dwguest@win.tue.nl)
Date: Mon Sep 18 2000 - 15:57:04 EST


On Mon, Sep 18, 2000 at 11:31:09AM -0500, Matt_Domsch@dell.com wrote:

> This patch prevents scsi_ioctl_send_command() from overwriting the SEND
> DIAGNOSTICS (Drive Self Test) reserved bits in cmd[1], as found in SCSI-3.
> Code provided by Michael Landrus of Dell.
>
> Comments are requested. If there are no objections, Linus and Alan please
> apply.
> Below are patches to kernels 2.2.18-pre8 and 2.4.0-test9-pre1.

> - cmd[1] = ( cmd[1] & 0x1f ) | (dev->lun << 5);
> + if ( cmd[0] != 0x1d ) // don't overwrite the SCSI-3 SEND DIAGNOSTICS
> reserved bits
> + cmd[1] = (cmd[1] & 0x1f) | (dev->lun << 5);

I am a bit surprised: why only SEND DIAGNOSTICS?

If I am not mistaken SCSI-1 used this 3-bit LUN field in all commands,
and SCSI-2 still does, but the standard says:

----------------------------------------------------------------------------
7.2.2 Logical unit number
...
   NOTICE: The logical unit number field is included in the command descriptor
   block for compatibility with some SCSI-1 devices. This field may be
   reclaimed in SCSI-3.
----------------------------------------------------------------------------

and SCSI-3 calls these bits "reserved", for all commands, also for
SEND DIAGNOSTICS.

So:
(i) I don't see what is special with SEND DIAGNOSTICS. Maybe for SCSI-3
the lun should never be inserted.
(ii) On the other hand, for SCSI-1 the lun should always be inserted.

Once these bits really get used again
(are there already examples of a new use?)
I suppose we should introduce a new SCSI3_IOCTL_SEND_COMMAND
instead of changing SCSI_IOCTL_SEND_COMMAND.

Andries
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 23 2000 - 21:00:18 EST