Commit:     607126c2a21cd6e9bb807fdd415c1a992f7b9009
Parent:     f442cd86c1c86c5f44bc2cf23f89536f7e4cfe59
Author:     Mark Lord <[EMAIL PROTECTED]>
AuthorDate: Thu Nov 15 13:13:59 2007 +0900
Committer:  Tejun Heo <[EMAIL PROTECTED]>
CommitDate: Mon Nov 19 12:28:11 2007 +0900

    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
    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]>
 drivers/ata/libata-scsi.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index 94144ed..a45f6ac 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2869,7 +2869,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd 
                xlat_func = NULL;
                if (likely((scsi_op != ATA_16) || !atapi_passthru16)) {
                        /* relay SCSI command to ATAPI device */
-                       if (unlikely(scmd->cmd_len > dev->cdb_len))
+                       int len = COMMAND_SIZE(scsi_op);
+                       if (unlikely(len > scmd->cmd_len || len > dev->cdb_len))
                                goto bad_cdb_len;
                        xlat_func = atapi_xlat;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to