Skip to content

Commit 607126c

Browse files
Mark Lordhtejun
Mark Lord
authored andcommitted
libata-scsi: be tolerant of 12-byte ATAPI commands in 16-byte CDBs
Sebastian Kemper reported that issuing CD/DVD commands under libata is not fully compatible with ide-scsi. In particular, the GPCMD_SET_STREAMING was being rejected at the host level in some instances. The reason is that libata-scsi insists upon the cmd_len field exactly matching the SCSI opcode being issued, whereas ide-scsi tolerates 12-byte commands contained within a 16-byte (cmd_len) CDB. There doesn't seem to be a good reason for us to not be compatible there, so here is a patch to fix libata-scsi to permit SCSI opcodes so long as they fit within whatever size CDB is provided. Signed-off-by: Mark Lord <[email protected]> Signed-off-by: Tejun Heo <[email protected]>
1 parent f442cd8 commit 607126c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/ata/libata-scsi.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -2869,7 +2869,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd,
28692869
xlat_func = NULL;
28702870
if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
28712871
/* relay SCSI command to ATAPI device */
2872-
if (unlikely(scmd->cmd_len > dev->cdb_len))
2872+
int len = COMMAND_SIZE(scsi_op);
2873+
if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
28732874
goto bad_cdb_len;
28742875

28752876
xlat_func = atapi_xlat;

0 commit comments

Comments
 (0)