Commit 7ef55f67 authored by Finn Thain's avatar Finn Thain Committed by Martin K. Petersen

scsi: NCR5380: Check for invalid reselection target

The X3T9.2 specification (draft) says, under "6.1.4.1 RESELECTION", that "the
initiator shall not respond to a RESELECTION phase if other than two SCSI ID
bits are on the DATA BUS." This issue (too many bits set) has been observed in
the wild, so add a check.
Tested-by: default avatarMichael Schmitz <schmitzmic@gmail.com>
Signed-off-by: default avatarFinn Thain <fthain@telegraphics.com.au>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 07035651
...@@ -2016,6 +2016,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance) ...@@ -2016,6 +2016,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
NCR5380_write(MODE_REG, MR_BASE); NCR5380_write(MODE_REG, MR_BASE);
target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask); target_mask = NCR5380_read(CURRENT_SCSI_DATA_REG) & ~(hostdata->id_mask);
if (!target_mask || target_mask & (target_mask - 1)) {
shost_printk(KERN_WARNING, instance,
"reselect: bad target_mask 0x%02x\n", target_mask);
return;
}
dsprintk(NDEBUG_RESELECTION, instance, "reselect\n"); dsprintk(NDEBUG_RESELECTION, instance, "reselect\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment