Skip to content

Commit 1c71065

Browse files
fthainmartinkpetersen
authored andcommitted
scsi: NCR5380: Initialize buffer for MSG IN and STATUS transfers
Following an incomplete transfer in MSG IN phase, the driver would not notice the problem and would make use of invalid data. Initialize 'tmp' appropriately and bail out if no message was received. For STATUS phase, preserve the existing status code unless a new value was transferred. Tested-by: Stan Johnson <[email protected]> Signed-off-by: Finn Thain <[email protected]> Link: https://lore.kernel.org/r/52e02a8812ae1a2d810d7f9f7fd800c3ccc320c4.1723001788.git.fthain@linux-m68k.org Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 2ac6d29 commit 1c71065

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

drivers/scsi/NCR5380.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1807,8 +1807,11 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
18071807
return;
18081808
case PHASE_MSGIN:
18091809
len = 1;
1810+
tmp = 0xff;
18101811
data = &tmp;
18111812
NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
1813+
if (tmp == 0xff)
1814+
break;
18121815
ncmd->message = tmp;
18131816

18141817
switch (tmp) {
@@ -1996,6 +1999,7 @@ static void NCR5380_information_transfer(struct Scsi_Host *instance)
19961999
break;
19972000
case PHASE_STATIN:
19982001
len = 1;
2002+
tmp = ncmd->status;
19992003
data = &tmp;
20002004
NCR5380_transfer_pio(instance, &phase, &len, &data, 0);
20012005
ncmd->status = tmp;

0 commit comments

Comments
 (0)