Skip to content

Commit

Permalink
[SCSI] stex: fix scan of nonexistent lun
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ed Lin authored and James Bottomley committed Jan 4, 2010
1 parent a70757b commit 91e6eca
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions drivers/scsi/stex.c
Original file line number Diff line number Diff line change
Expand Up @@ -623,6 +623,11 @@ stex_queuecommand(struct scsi_cmnd *cmd, void (* done)(struct scsi_cmnd *))
}
break;
case INQUIRY:
if (lun >= host->max_lun) {
cmd->result = DID_NO_CONNECT << 16;
done(cmd);
return 0;
}
if (id != host->max_id - 1)
break;
if (!lun && !cmd->device->channel &&
Expand Down

0 comments on commit 91e6eca

Please sign in to comment.