* [PATCH] RESEND: libata: check cdb len per dev instead of per host
@ 2007-02-02 17:36 Mark Lord
2007-03-03 0:26 ` Jeff Garzik
0 siblings, 1 reply; 2+ messages in thread
From: Mark Lord @ 2007-02-02 17:36 UTC (permalink / raw)
To: Jeff Garzik, IDE/ATA development list; +Cc: Tejun Heo
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 <mlord@pobox.com>
---
diff -u --recursive --new-file --exclude-from=old/Documentation/dontdiff old/drivers/ata/libata-core.c new/drivers/ata/libata-core.c
--- old/drivers/ata/libata-core.c 2007-02-02 12:26:28.000000000 -0500
+++ new/drivers/ata/libata-core.c 2007-02-02 12:23:39.000000000 -0500
@@ -1573,20 +1573,6 @@
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
@@ -1767,8 +1753,6 @@
}
}
- 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)
@@ -5675,7 +5659,7 @@
shost->max_id = 16;
shost->max_lun = 1;
shost->max_channel = 1;
- shost->max_cmd_len = 12;
+ shost->max_cmd_len = 16;
}
/**
diff -u --recursive --new-file --exclude-from=old/Documentation/dontdiff old/drivers/ata/libata-scsi.c new/drivers/ata/libata-scsi.c
--- old/drivers/ata/libata-scsi.c 2007-02-02 12:26:28.000000000 -0500
+++ new/drivers/ata/libata-scsi.c 2007-02-02 12:25:20.000000000 -0500
@@ -2748,8 +2748,9 @@
{
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;
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] RESEND: libata: check cdb len per dev instead of per host
2007-02-02 17:36 [PATCH] RESEND: libata: check cdb len per dev instead of per host Mark Lord
@ 2007-03-03 0:26 ` Jeff Garzik
0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2007-03-03 0:26 UTC (permalink / raw)
To: Mark Lord; +Cc: IDE/ATA development list, Tejun Heo
Mark Lord wrote:
> 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 <mlord@pobox.com>
applied, though I am disappointed that we had to add this check (as well
as another one in an unrelated Tejun patch) to the fast path
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-03-03 0:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-02 17:36 [PATCH] RESEND: libata: check cdb len per dev instead of per host Mark Lord
2007-03-03 0:26 ` Jeff Garzik
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).