in ata_scsi_pass_thru()
Hi, all.
In the translation function ata_scsi_pass_thru(), when it determines that the command cannot be translated and should be finished early, it does NOT set sense data or result code. This seems buggy. Is this intentional?
Thanks.
Signature · 1 line
tejun
Quoted 3 lines · Tejun Heo
Hi, all.
In the translation function
ata_scsi_pass_thru(), when it determines that the command cannot be translated and should be finished early, it does NOT set sense data or result code. This seems buggy. Is this intentional?
Yes, a bug.
Jeff
PATCH 1/1 libata: fix ata_scsi_pass_thru error handling
This patch makes ata_scsi_pass_thru() properly set result code and sense data on translation failures.
Signed-off-by Tejun Heo <[email protected]>
drivers/scsi/libata-scsi.c +7 -2
@@ -2233,7 +2233,7 @@ ata_scsi_pass_thru(struct ata_queued_cmdstruct scsi_cmnd *cmd = qc->scsicmd;if ((tf->protocol =ata_scsi_map_proto (scsicmd[1 ])) ==ATA_PROT_UNKNOWN ) -return 1 ; + goto invalid_fld;/* * 12 and 16 byte CDBs use different offsets to
@@ -2295,7 +2295,7 @@ ata_scsi_pass_thru(struct ata_queued_cmd*/ if ((tf->command ==ATA_CMD_SET_FEATURES ) && (tf->feature ==SETFEATURES_XFER )) -return 1 ; + goto invalid_fld;/* * Set flags so that all registers will be written,
@@ -2316,6 +2316,11 @@ ata_scsi_pass_thru(struct ata_queued_cmd qc->nsect = cmd->bufflen /ATA_SECT_SIZE ;return 0 ; + + invalid_fld: +ata_scsi_set_sense (qc->scsicmd,ILLEGAL_REQUEST ,0x24 ,0x00 ); +/* "Invalid field in cdb" */ +return 1 ; }/**
Jeff Garzik
AppliedRe: [PATCH] libata: fix ata_scsi_pass_thru error handling
applied