linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 4/4] libata: Check per device max cdb length for SAS
@ 2006-06-28 13:30 Brian King
  2006-06-29  4:53 ` [PATCH 4/4] libata: Check per device max cdb length for SAS - drop Brian King
  0 siblings, 1 reply; 2+ messages in thread
From: Brian King @ 2006-06-28 13:30 UTC (permalink / raw)
  To: jgarzik; +Cc: linux-ide, linux-scsi, brking


Since libata does not own any scsi_host struct for
SAS attached SATA devices, libata cannot rely on scsi
core checking the max_cmd_len. This patch adds additional
checking into the SAS queuecommand path to prevent
too large of a cdb from being issued to an ATA or ATAPI device.

Signed-off-by: Brian King <brking@us.ibm.com>
---

 libata-dev-bjking1/drivers/scsi/libata-scsi.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff -puN drivers/scsi/libata-scsi.c~libata_sas_cdb_len drivers/scsi/libata-scsi.c
--- libata-dev/drivers/scsi/libata-scsi.c~libata_sas_cdb_len	2006-06-27 14:43:35.000000000 -0500
+++ libata-dev-bjking1/drivers/scsi/libata-scsi.c	2006-06-27 14:43:35.000000000 -0500
@@ -3207,9 +3207,13 @@ int ata_sas_queuecmd(struct scsi_cmnd *c
 {
 	ata_scsi_dump_cdb(ap, cmd);
 
-	if (likely(ata_scsi_dev_enabled(ap->device)))
-		__ata_scsi_queuecmd(cmd, done, ap->device);
-	else {
+	if (likely(ata_scsi_dev_enabled(ap->device))) {
+		if (unlikely(cmd->cmd_len > ap->device->cdb_len)) {
+			cmd->result = (DID_ABORT << 16);
+			done(cmd);
+		} else
+			__ata_scsi_queuecmd(cmd, done, ap->device);
+	} else {
 		cmd->result = (DID_BAD_TARGET << 16);
 		done(cmd);
 	}
_

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2006-06-29  4:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-28 13:30 [PATCH 4/4] libata: Check per device max cdb length for SAS Brian King
2006-06-29  4:53 ` [PATCH 4/4] libata: Check per device max cdb length for SAS - drop Brian King

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).