aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi
diff options
context:
space:
mode:
authorEd Lin <ed.lin@promise.com>2009-12-18 20:34:51 -0500
committerJames Bottomley <James.Bottomley@suse.de>2010-01-04 12:39:41 -0500
commit91e6ecada757a6e2ef7b937634af8a04376772a1 (patch)
tree6400b2a5a34b62787e69c0ca79e7466534124e32 /drivers/scsi
parenta70757ba9a3719f99760713c3b72134b21016c6e (diff)
[SCSI] stex: fix scan of nonexistent lun
During a manual scan, a user can send command to a nonexistent lun, precisely at the point of max_lun. Normally it's possible (but not required) that the firmware has the knowledge that it is an invalid lun. In the particular case when max_lun is 256, however, the nonexistent lun 256 will be confused with lun 0, because the lun member in a request message is only u8, and 256 will become 0. So we need to fix the problem, at least, at the driver level. Signed-off-by: Ed Lin <ed.lin@promise.com> Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi')
-rw-r--r--drivers/scsi/stex.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/stex.c b/drivers/scsi/stex.c
index 3058bb1aff95..fd7b15be7640 100644
--- a/drivers/scsi/stex.c
+++ b/drivers/scsi/stex.c
@@ -623,6 +623,11 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
623 } 623 }
624 break; 624 break;
625 case INQUIRY: 625 case INQUIRY:
626 if (lun >= host->max_lun) {
627 cmd->result = DID_NO_CONNECT << 16;
628 done(cmd);
629 return 0;
630 }
626 if (id != host->max_id - 1) 631 if (id != host->max_id - 1)
627 break; 632 break;
628 if (!lun && !cmd->device->channel && 633 if (!lun && !cmd->device->channel &&