Skip to content

Commit

Permalink
[SCSI] libiscsi: fix possbile null ptr session command cleanup
Browse files Browse the repository at this point in the history
If the iscsi eh fires when the current task is a nop, then
the task->sc pointer is null. fail_all_commands could
then try to do task->sc->device and oops. We actually do
not need to access the curr task in this path, because
if it is a cmd task the fail_command call will handle
this and if it is mgmt task then the flush of the mgmt
queues will handle that.

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 Mar 13, 2009
1 parent 5e7facb commit 7289968
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions drivers/scsi/libiscsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,8 +1603,11 @@ static void fail_all_commands(struct iscsi_conn *conn, unsigned lun,
{
struct iscsi_task *task, *tmp;

if (conn->task && (conn->task->sc->device->lun == lun || lun == -1))
conn->task = NULL;
if (conn->task) {
if (lun == -1 ||
(conn->task->sc && conn->task->sc->device->lun == lun))
conn->task = NULL;
}

/* flush pending */
list_for_each_entry_safe(task, tmp, &conn->xmitqueue, running) {
Expand Down

0 comments on commit 7289968

Please sign in to comment.