Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

be2iscsi : Fix memory check before unmapping.

Check DMA memory before it is unmapped.

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@Odin.com>

authored by

John Soni Jose and committed by
James Bottomley
eb1c4692 4e2bdf7a

+7 -3
+7 -3
drivers/scsi/be2iscsi/be_main.c
··· 1368 1368 if (io_task->cmd_bhs->iscsi_hdr.flags & ISCSI_FLAG_CMD_READ) 1369 1369 conn->rxdata_octets += resid; 1370 1370 unmap: 1371 - scsi_dma_unmap(io_task->scsi_cmnd); 1372 - io_task->scsi_cmnd = NULL; 1371 + if (io_task->scsi_cmnd) { 1372 + scsi_dma_unmap(io_task->scsi_cmnd); 1373 + io_task->scsi_cmnd = NULL; 1374 + } 1373 1375 iscsi_complete_scsi_task(task, exp_cmdsn, max_cmdsn); 1374 1376 } 1375 1377 ··· 4611 4609 spin_unlock_bh(&phba->mgmt_sgl_lock); 4612 4610 } 4613 4611 4614 - if (io_task->mtask_addr) 4612 + if (io_task->mtask_addr) { 4615 4613 pci_unmap_single(phba->pcidev, 4616 4614 io_task->mtask_addr, 4617 4615 io_task->mtask_data_count, 4618 4616 PCI_DMA_TODEVICE); 4617 + io_task->mtask_addr = 0; 4618 + } 4619 4619 } 4620 4620 4621 4621 /**