[PATCH 3/5] be2iscsi: fix null ptr when accessing task hdr

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: michaelc
Date: Friday, December 31, 2010 - 1:22 am

From: Mike Christie <michaelc@cs.wisc.edu>

If alloc_pdu fails then the task->hdr pointer may not be
set. This adds a check for this case in the cleanup callback.

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
---
 drivers/scsi/be2iscsi/be_main.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/scsi/be2iscsi/be_main.c b/drivers/scsi/be2iscsi/be_main.c
index be07ca0..79cefbe 100644
--- a/drivers/scsi/be2iscsi/be_main.c
+++ b/drivers/scsi/be2iscsi/be_main.c
@@ -3914,7 +3914,8 @@ static void beiscsi_cleanup_task(struct iscsi_task *task)
 			io_task->psgl_handle = NULL;
 		}
 	} else {
-		if ((task->hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN)
+		if (task->hdr &&
+		   ((task->hdr->opcode & ISCSI_OPCODE_MASK) == ISCSI_OP_LOGIN))
 			return;
 		if (io_task->psgl_handle) {
 			spin_lock(&phba->mgmt_sgl_lock);
-- 
1.7.0.1

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
iscsi changes for 2.6.38, michaelc, (Fri Dec 31, 1:22 am)
[PATCH 2/5] be2iscsi: fix gfp use in alloc_pdu, michaelc, (Fri Dec 31, 1:22 am)
[PATCH 3/5] be2iscsi: fix null ptr when accessing task hdr, michaelc, (Fri Dec 31, 1:22 am)