Skip to content

Commit

Permalink
[SCSI] libiscsi: clear conn->ctask when task is completed early
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Mike Christie authored and James Bottomley committed Jan 12, 2008
1 parent 9000bcd commit c1635cb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion drivers/scsi/libiscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit c1635cb

Please sign in to comment.