Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=f0ef88ed413232daebfe675c7b1bbf100d604d4b
Commit:     f0ef88ed413232daebfe675c7b1bbf100d604d4b
Parent:     cd0d3bbcdd650651b7ccfaf55d107e3fc237d95a
Author:     Mark Lord <[EMAIL PROTECTED]>
AuthorDate: Fri Feb 2 12:36:25 2007 -0500
Committer:  Jeff Garzik <[EMAIL PROTECTED]>
CommitDate: Sat Apr 28 14:15:55 2007 -0400

    RESEND: libata: check cdb len per dev instead of per host
    
    Resending, with s/printk/DPRINTK/ as pointed out by Alan.
    
    Fix libata to perform CDB len validation per device
    rather than per host.  This way, validation still works
    when we have a mix of 12-byte and 16-byte devices on
    a common host interface.
    
    Signed-off-by: Mark Lord <[EMAIL PROTECTED]>
    Signed-off-by: Jeff Garzik <[EMAIL PROTECTED]>
---
 drivers/ata/libata-core.c |   18 +-----------------
 drivers/ata/libata-scsi.c |    5 +++--
 2 files changed, 4 insertions(+), 19 deletions(-)

diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c
index 2b998b3..99a8815 100644
--- a/drivers/ata/libata-core.c
+++ b/drivers/ata/libata-core.c
@@ -1560,20 +1560,6 @@ static void ata_dev_config_ncq(struct ata_device *dev,
                snprintf(desc, desc_sz, "NCQ (depth %d/%d)", hdepth, ddepth);
 }
 
-static void ata_set_port_max_cmd_len(struct ata_port *ap)
-{
-       int i;
-
-       if (ap->scsi_host) {
-               unsigned int len = 0;
-
-               for (i = 0; i < ATA_MAX_DEVICES; i++)
-                       len = max(len, ap->device[i].cdb_len);
-
-               ap->scsi_host->max_cmd_len = len;
-       }
-}
-
 /**
  *     ata_dev_configure - Configure the specified ATA/ATAPI device
  *     @dev: Target device to configure
@@ -1773,8 +1759,6 @@ int ata_dev_configure(struct ata_device *dev)
                }
        }
 
-       ata_set_port_max_cmd_len(ap);
-
        /* limit bridge transfers to udma5, 200 sectors */
        if (ata_dev_knobble(dev)) {
                if (ata_msg_drv(ap) && print_info)
@@ -5670,7 +5654,7 @@ static void ata_port_init_shost(struct ata_port *ap, 
struct Scsi_Host *shost)
        shost->max_id = 16;
        shost->max_lun = 1;
        shost->max_channel = 1;
-       shost->max_cmd_len = 12;
+       shost->max_cmd_len = 16;
 }
 
 /**
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c
index e936443..7d41afe 100644
--- a/drivers/ata/libata-scsi.c
+++ b/drivers/ata/libata-scsi.c
@@ -2792,8 +2792,9 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd 
*scmd,
 {
        int rc = 0;
 
-       if (unlikely(!scmd->cmd_len)) {
-               ata_dev_printk(dev, KERN_WARNING, "WARNING: zero len CDB\n");
+       if (unlikely(!scmd->cmd_len || scmd->cmd_len > dev->cdb_len)) {
+               DPRINTK("bad CDB len=%u, max=%u\n",
+                       scmd->cmd_len, dev->cdb_len);
                scmd->result = DID_ERROR << 16;
                done(scmd);
                return 0;
-
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  http://vger.kernel.org/majordomo-info.html

Reply via email to