提交 72899682 编写于 作者: M Mike Christie 提交者: James Bottomley

[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: NMike Christie <michaelc@cs.wisc.edu>
Signed-off-by: NJames Bottomley <James.Bottomley@HansenPartnership.com>
上级 5e7facb7
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册