]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
be2iscsi : Fix memory check before unmapping.
authorJitendra Bhivare <jitendra.bhivare@avagotech.com>
Fri, 9 Oct 2015 10:08:19 +0000 (15:38 +0530)
committerDan Duval <dan.duval@oracle.com>
Mon, 12 Oct 2015 18:44:53 +0000 (14:44 -0400)
Orabug: 21862307

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>
Signed-off-by: Dan Duval <dan.duval@oracle.com>
drivers/scsi/be2iscsi/be_main.c

index 1f74760ce86cb27db2308f4dbe1d9ba25f10bcaa..1310d9ea90b7f6574d43fabefdcc2b79fa1225f3 100644 (file)
@@ -1356,8 +1356,10 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
        if (io_task->cmd_bhs->iscsi_hdr.flags & ISCSI_FLAG_CMD_READ)
                conn->rxdata_octets += resid;
 unmap:
+       if (io_task->scsi_cmnd) {
        scsi_dma_unmap(io_task->scsi_cmnd);
        io_task->scsi_cmnd = NULL;
+       }
        iscsi_complete_scsi_task(task, exp_cmdsn, max_cmdsn);
 }
 
@@ -4580,11 +4582,13 @@ beiscsi_free_mgmt_task_handles(struct beiscsi_conn *beiscsi_conn,
                spin_unlock_bh(&phba->mgmt_sgl_lock);
        }
 
-       if (io_task->mtask_addr)
+       if (io_task->mtask_addr) {
                pci_unmap_single(phba->pcidev,
                                 io_task->mtask_addr,
                                 io_task->mtask_data_count,
                                 PCI_DMA_TODEVICE);
+               io_task->mtask_addr = 0;
+       }
 }
 
 /**