[SCSI] be2iscsi: Fix for case where task->sc was cleanedup earlier
authorJayamohan Kallickal <jayamohan.kallickal@emulex.com>
Sat, 8 Oct 2011 00:31:10 +0000 (19:31 -0500)
committerJames Bottomley <JBottomley@Parallels.com>
Sun, 16 Oct 2011 16:03:19 +0000 (11:03 -0500)
This patch fixes a bug where the task->sc was cleaned up earlier on a
different thread, possibly abort, and the completion comes later.

This was causing a crash which has been reported in multiple places

Signed-off-by: Jayamohan Kallickal <jayamohan.kallickal@emulex.com>
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/be2iscsi/be_main.c

index e166d547a3412a278fe48c422681fdf7a031ca26..7b0a8ab710494c120d0d7b2338ebe218e6883cbf 100644 (file)
@@ -1123,7 +1123,12 @@ be_complete_io(struct beiscsi_conn *beiscsi_conn,
                                                & SOL_STS_MASK) >> 8);
        flags = ((psol->dw[offsetof(struct amap_sol_cqe, i_flags) / 32]
                                        & SOL_FLAGS_MASK) >> 24) | 0x80;
+       if (!task->sc) {
+               if (io_task->scsi_cmnd)
+                       scsi_dma_unmap(io_task->scsi_cmnd);
 
+               return;
+       }
        task->sc->result = (DID_OK << 16) | status;
        if (rsp != ISCSI_STATUS_CMD_COMPLETED) {
                task->sc->result = DID_ERROR << 16;