Skip to content

Commit da33497

Browse files
Jayamohan KallickalJames Bottomley
authored andcommitted
[SCSI] be2iscsi: Fix scsi_cmnd leakage in driver.
scsi_cmnd n io_task was not NULL when - Link goes down while IO was happening and session is closed. - Task for which TMF was sent. Signed-off-by: John Soni Jose <sony.john-n@emulex.com> Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com> Reviewed-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
1 parent 9343be7 commit da33497

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

‎drivers/scsi/be2iscsi/be_main.c‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1366,8 +1366,10 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
13661366
resid = csol_cqe->res_cnt;
13671367

13681368
if (!task->sc) {
1369-
if (io_task->scsi_cmnd)
1369+
if (io_task->scsi_cmnd) {
13701370
scsi_dma_unmap(io_task->scsi_cmnd);
1371+
io_task->scsi_cmnd = NULL;
1372+
}
13711373

13721374
return;
13731375
}
@@ -1404,6 +1406,7 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
14041406
conn->rxdata_octets += resid;
14051407
unmap:
14061408
scsi_dma_unmap(io_task->scsi_cmnd);
1409+
io_task->scsi_cmnd = NULL;
14071410
iscsi_complete_scsi_task(task, exp_cmdsn, max_cmdsn);
14081411
}
14091412

@@ -4653,6 +4656,11 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
46534656
spin_unlock(&phba->io_sgl_lock);
46544657
io_task->psgl_handle = NULL;
46554658
}
4659+
4660+
if (io_task->scsi_cmnd) {
4661+
scsi_dma_unmap(io_task->scsi_cmnd);
4662+
io_task->scsi_cmnd = NULL;
4663+
}
46564664
} else {
46574665
if (!beiscsi_conn->login_in_progress)
46584666
beiscsi_free_mgmt_task_handles(beiscsi_conn, task);

0 commit comments

Comments
 (0)