Skip to content

Commit 7709e9b

Browse files
Dan Carpentermartinkpetersen
authored andcommitted
scsi: dpt_i2o: Use after free in I2ORESETCMD ioctl
Here is another use after free if we reset the card. The adpt_hba_reset() function frees "pHba" on error. Signed-off-by: Dan Carpenter <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent f4abab3 commit 7709e9b

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

drivers/scsi/dpt_i2o.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2051,13 +2051,16 @@ static int adpt_ioctl(struct inode *inode, struct file *file, uint cmd, ulong ar
20512051
}
20522052
break;
20532053
}
2054-
case I2ORESETCMD:
2055-
if(pHba->host)
2056-
spin_lock_irqsave(pHba->host->host_lock, flags);
2054+
case I2ORESETCMD: {
2055+
struct Scsi_Host *shost = pHba->host;
2056+
2057+
if (shost)
2058+
spin_lock_irqsave(shost->host_lock, flags);
20572059
adpt_hba_reset(pHba);
2058-
if(pHba->host)
2059-
spin_unlock_irqrestore(pHba->host->host_lock, flags);
2060+
if (shost)
2061+
spin_unlock_irqrestore(shost->host_lock, flags);
20602062
break;
2063+
}
20612064
case I2ORESCANCMD:
20622065
adpt_rescan(pHba);
20632066
break;

0 commit comments

Comments
 (0)