summaryrefslogtreecommitdiff
path: root/drivers/scsi/libiscsi.c
diff options
context:
space:
mode:
authorMike Christie <michaelc@cs.wisc.edu>2007-12-13 12:43:33 -0600
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-01-11 18:28:39 -0600
commitc1635cb786dbadd16fd6e6959dd3b41ae2f2831a (patch)
tree0f30320469678b00d4f26af15663cf1a8b1f2ff3 /drivers/scsi/libiscsi.c
parent9000bcd649b26aef4c35d2941f8a65f05bbb9ee1 (diff)
downloadlwn-c1635cb786dbadd16fd6e6959dd3b41ae2f2831a.tar.gz
lwn-c1635cb786dbadd16fd6e6959dd3b41ae2f2831a.zip
[SCSI] libiscsi: clear conn->ctask when task is completed early
If the current ctask is failed early, we legt the conn->ctask pointer pointing to a invalid task. When the xmit thread would send data for it, we would then oops. Signed-off-by: Mike Christie <michaelc@cs.wisc.edu> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r--drivers/scsi/libiscsi.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c
index b17081bed128..4461317e617f 100644
--- a/drivers/scsi/libiscsi.c
+++ b/drivers/scsi/libiscsi.c
@@ -248,13 +248,16 @@ static int iscsi_prep_scsi_cmd_pdu(struct iscsi_cmd_task *ctask)
*/
static void iscsi_complete_command(struct iscsi_cmd_task *ctask)
{
- struct iscsi_session *session = ctask->conn->session;
+ struct iscsi_conn *conn = ctask->conn;
+ struct iscsi_session *session = conn->session;
struct scsi_cmnd *sc = ctask->sc;
ctask->state = ISCSI_TASK_COMPLETED;
ctask->sc = NULL;
/* SCSI eh reuses commands to verify us */
sc->SCp.ptr = NULL;
+ if (conn->ctask == ctask)
+ conn->ctask = NULL;
list_del_init(&ctask->running);
__kfifo_put(session->cmdpool.queue, (void*)&ctask, sizeof(void*));
sc->scsi_done(sc);