summaryrefslogtreecommitdiff
path: root/drivers/scsi/dpt_i2o.c
diff options
context:
space:
mode:
authorDan Carpenter <dan.carpenter@oracle.com>2018-03-19 13:33:03 +0300
committerMartin K. Petersen <martin.petersen@oracle.com>2018-03-22 01:33:04 +0300
commit24268fd1ad3213079f1af09359b4243fffa95869 (patch)
treed5c5816818626e0382e92753570523f99b41d0a0 /drivers/scsi/dpt_i2o.c
parent83c9f08e6c6a6dc668384882de4dcf5ef4ae0ba7 (diff)
downloadlinux-24268fd1ad3213079f1af09359b4243fffa95869.tar.xz
scsi: dpt_i2o: use after free in adpt_release()
The scsi_host_put() function frees "pHba" and then we dereference it on the next line when we do "scsi_host_put(pHba->host);". [mkp: included fix from hch] Fixes: 38e09e3bb056 ("scsi: dpt_i2o: stop using scsi_unregister") Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Diffstat (limited to 'drivers/scsi/dpt_i2o.c')
-rw-r--r--drivers/scsi/dpt_i2o.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/scsi/dpt_i2o.c b/drivers/scsi/dpt_i2o.c
index 3c667b23a801..67379e4d0bf9 100644
--- a/drivers/scsi/dpt_i2o.c
+++ b/drivers/scsi/dpt_i2o.c
@@ -304,10 +304,12 @@ rebuild_sys_tab:
static void adpt_release(adpt_hba *pHba)
{
- scsi_remove_host(pHba->host);
+ struct Scsi_Host *shost = pHba->host;
+
+ scsi_remove_host(shost);
// adpt_i2o_quiesce_hba(pHba);
adpt_i2o_delete_hba(pHba);
- scsi_host_put(pHba->host);
+ scsi_host_put(shost);
}