Linux ATA/IDE development
 help / color / mirror / Atom feed
* [PATCH] ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES
@ 2023-09-18 20:24 Niklas Cassel
  2023-09-18 20:31 ` Niklas Cassel
  2023-09-19 17:27 ` Damien Le Moal
  0 siblings, 2 replies; 3+ messages in thread
From: Niklas Cassel @ 2023-09-18 20:24 UTC (permalink / raw)
  To: Damien Le Moal; +Cc: linux-ide, Niklas Cassel

From: Niklas Cassel <niklas.cassel@wdc.com>

For REPORT SUPPORTED OPERATION CODES command, the service action field is
defined as bits 0-4 in the second byte in the CDB. Bits 5-7 in the second
byte are reserved.

Only look at the service action field in the second byte when determining
if the MAINTENANCE IN opcode is a REPORT SUPPORTED OPERATION CODES command.

This matches how we only look at the service action field in the second
byte when determining if the SERVICE ACTION IN(16) opcode is a READ
CAPACITY(16) command (reserved bits 5-7 in the second byte are ignored).

Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
---
 drivers/ata/libata-scsi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index d3f28b82c97b..fb73c145b49a 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -4312,7 +4312,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
 		break;
 
 	case MAINTENANCE_IN:
-		if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES)
+		if ((scsicmd[1] & 0x1f) == MI_REPORT_SUPPORTED_OPERATION_CODES)
 			ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in);
 		else
 			ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
-- 
2.41.0


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

* Re: [PATCH] ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES
  2023-09-18 20:24 [PATCH] ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES Niklas Cassel
@ 2023-09-18 20:31 ` Niklas Cassel
  2023-09-19 17:27 ` Damien Le Moal
  1 sibling, 0 replies; 3+ messages in thread
From: Niklas Cassel @ 2023-09-18 20:31 UTC (permalink / raw)
  To: Niklas Cassel; +Cc: Damien Le Moal, linux-ide@vger.kernel.org

On Mon, Sep 18, 2023 at 10:24:50PM +0200, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
> 
> For REPORT SUPPORTED OPERATION CODES command, the service action field is
> defined as bits 0-4 in the second byte in the CDB. Bits 5-7 in the second
> byte are reserved.
> 
> Only look at the service action field in the second byte when determining
> if the MAINTENANCE IN opcode is a REPORT SUPPORTED OPERATION CODES command.
> 
> This matches how we only look at the service action field in the second
> byte when determining if the SERVICE ACTION IN(16) opcode is a READ
> CAPACITY(16) command (reserved bits 5-7 in the second byte are ignored).
> 
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>
> ---
>  drivers/ata/libata-scsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index d3f28b82c97b..fb73c145b49a 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -4312,7 +4312,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
>  		break;
>  
>  	case MAINTENANCE_IN:
> -		if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES)
> +		if ((scsicmd[1] & 0x1f) == MI_REPORT_SUPPORTED_OPERATION_CODES)
>  			ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in);
>  		else
>  			ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);
> -- 
> 2.41.0
> 

Fixes: 7b2030942859 ("libata: Add support for SCT Write Same")

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

* Re: [PATCH] ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES
  2023-09-18 20:24 [PATCH] ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES Niklas Cassel
  2023-09-18 20:31 ` Niklas Cassel
@ 2023-09-19 17:27 ` Damien Le Moal
  1 sibling, 0 replies; 3+ messages in thread
From: Damien Le Moal @ 2023-09-19 17:27 UTC (permalink / raw)
  To: Niklas Cassel; +Cc: linux-ide, Niklas Cassel

On 2023/09/18 13:24, Niklas Cassel wrote:
> From: Niklas Cassel <niklas.cassel@wdc.com>
> 
> For REPORT SUPPORTED OPERATION CODES command, the service action field is
> defined as bits 0-4 in the second byte in the CDB. Bits 5-7 in the second
> byte are reserved.
> 
> Only look at the service action field in the second byte when determining
> if the MAINTENANCE IN opcode is a REPORT SUPPORTED OPERATION CODES command.
> 
> This matches how we only look at the service action field in the second
> byte when determining if the SERVICE ACTION IN(16) opcode is a READ
> CAPACITY(16) command (reserved bits 5-7 in the second byte are ignored).
> 
> Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com>

Applied to for-6.6-fixes with the Fixes tag added. Thanks !

> ---
>  drivers/ata/libata-scsi.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
> index d3f28b82c97b..fb73c145b49a 100644
> --- a/drivers/ata/libata-scsi.c
> +++ b/drivers/ata/libata-scsi.c
> @@ -4312,7 +4312,7 @@ void ata_scsi_simulate(struct ata_device *dev, struct scsi_cmnd *cmd)
>  		break;
>  
>  	case MAINTENANCE_IN:
> -		if (scsicmd[1] == MI_REPORT_SUPPORTED_OPERATION_CODES)
> +		if ((scsicmd[1] & 0x1f) == MI_REPORT_SUPPORTED_OPERATION_CODES)
>  			ata_scsi_rbuf_fill(&args, ata_scsiop_maint_in);
>  		else
>  			ata_scsi_set_invalid_field(dev, cmd, 1, 0xff);

-- 
Damien Le Moal
Western Digital Research


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

end of thread, other threads:[~2023-09-19 17:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-09-18 20:24 [PATCH] ata: libata-scsi: ignore reserved bits for REPORT SUPPORTED OPERATION CODES Niklas Cassel
2023-09-18 20:31 ` Niklas Cassel
2023-09-19 17:27 ` Damien Le Moal

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox