summaryrefslogtreecommitdiff
path: root/drivers/scsi/NCR5380.c
diff options
context:
space:
mode:
authorFinn Thain <fthain@telegraphics.com.au>2018-09-27 11:17:11 +1000
committerMartin K. Petersen <martin.petersen@oracle.com>2018-09-28 02:19:45 -0400
commit7ef55f6744c45e3d7c85a3f74ada39b67ac741dd (patch)
tree2e0bdfe88b70eed41d5f8468fa47c8b72dc6f25e /drivers/scsi/NCR5380.c
parent070356513963be6196142acff56acc8359069fa1 (diff)
downloadlwn-7ef55f6744c45e3d7c85a3f74ada39b67ac741dd.tar.gz
lwn-7ef55f6744c45e3d7c85a3f74ada39b67ac741dd.zip
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: Michael Schmitz <schmitzmic@gmail.com> Signed-off-by: Finn Thain <fthain@telegraphics.com.au> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/NCR5380.c')
-rw-r--r--drivers/scsi/NCR5380.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/scsi/NCR5380.c b/drivers/scsi/NCR5380.c
index e96a48b9e86c..3058b68b6740 100644
--- a/drivers/scsi/NCR5380.c
+++ b/drivers/scsi/NCR5380.c
@@ -2016,6 +2016,11 @@ static void NCR5380_reselect(struct Scsi_Host *instance)
NCR5380_write(MODE_REG, MR_BASE);
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");