diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2009-03-05 15:46:07 -0500 |
---|---|---|
committer | James Bottomley <James.Bottomley@HansenPartnership.com> | 2009-03-13 16:29:54 -0400 |
commit | 728996829b3e2a3bbacb7390e6c040dd839cdf21 (patch) | |
tree | e2e0b41faa980aeb78c0cd407dec26c73a8c7514 /drivers/scsi/libiscsi.c | |
parent | 5e7facb77ff4b6961d936773fb1f175f7abf76b7 (diff) |
[SCSI] libiscsi: fix possbile null ptr session command cleanup
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>
Diffstat (limited to 'drivers/scsi/libiscsi.c')
-rw-r--r-- | drivers/scsi/libiscsi.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/scsi/libiscsi.c b/drivers/scsi/libiscsi.c index d07017911139..dfaa8adf099e 100644 --- a/drivers/scsi/libiscsi.c +++ b/drivers/scsi/libiscsi.c | |||
@@ -1603,8 +1603,11 @@ static void fail_all_commands(struct iscsi_conn *conn, unsigned lun, | |||
1603 | { | 1603 | { |
1604 | struct iscsi_task *task, *tmp; | 1604 | struct iscsi_task *task, *tmp; |
1605 | 1605 | ||
1606 | if (conn->task && (conn->task->sc->device->lun == lun || lun == -1)) | 1606 | if (conn->task) { |
1607 | conn->task = NULL; | 1607 | if (lun == -1 || |
1608 | (conn->task->sc && conn->task->sc->device->lun == lun)) | ||
1609 | conn->task = NULL; | ||
1610 | } | ||
1608 | 1611 | ||
1609 | /* flush pending */ | 1612 | /* flush pending */ |
1610 | list_for_each_entry_safe(task, tmp, &conn->xmitqueue, running) { | 1613 | list_for_each_entry_safe(task, tmp, &conn->xmitqueue, running) { |