diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2007-12-13 13:43:33 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2008-01-11 19:28:39 -0500 |
commit | c1635cb786dbadd16fd6e6959dd3b41ae2f2831a (patch) | |
tree | 0f30320469678b00d4f26af15663cf1a8b1f2ff3 | |
parent | 9000bcd649b26aef4c35d2941f8a65f05bbb9ee1 (diff) |
[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>
-rw-r--r-- | drivers/scsi/libiscsi.c | 5 |
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) | |||
248 | */ | 248 | */ |
249 | static void iscsi_complete_command(struct iscsi_cmd_task *ctask) | 249 | static void iscsi_complete_command(struct iscsi_cmd_task *ctask) |
250 | { | 250 | { |
251 | struct iscsi_session *session = ctask->conn->session; | 251 | struct iscsi_conn *conn = ctask->conn; |
252 | struct iscsi_session *session = conn->session; | ||
252 | struct scsi_cmnd *sc = ctask->sc; | 253 | struct scsi_cmnd *sc = ctask->sc; |
253 | 254 | ||
254 | ctask->state = ISCSI_TASK_COMPLETED; | 255 | ctask->state = ISCSI_TASK_COMPLETED; |
255 | ctask->sc = NULL; | 256 | ctask->sc = NULL; |
256 | /* SCSI eh reuses commands to verify us */ | 257 | /* SCSI eh reuses commands to verify us */ |
257 | sc->SCp.ptr = NULL; | 258 | sc->SCp.ptr = NULL; |
259 | if (conn->ctask == ctask) | ||
260 | conn->ctask = NULL; | ||
258 | list_del_init(&ctask->running); | 261 | list_del_init(&ctask->running); |
259 | __kfifo_put(session->cmdpool.queue, (void*)&ctask, sizeof(void*)); | 262 | __kfifo_put(session->cmdpool.queue, (void*)&ctask, sizeof(void*)); |
260 | sc->scsi_done(sc); | 263 | sc->scsi_done(sc); |