提交 9bfacd01 编写于 作者: R Roland Dreier 提交者: James Bottomley

[SCSI] qla2xxx: Fix crash in qla2x00_abort_all_cmds() on unload

I hit a crash in qla2x00_abort_all_cmds() if the qla2xxx module is
unloaded right after it is loaded.  I debugged this down to the abort
handling improperly treating a command of type SRB_ADISC_CMD as if it
had a bsg_job to complete when that command actually uses the iocb_cmd
part of the union.  (I guess to hit this one has to unload the module
while the async FC initialization is still in progress)

It seems we should only look for a bsg_job if type is SRB_ELS_CMD_RPT,
SRB_ELS_CMD_HST or SRB_CT_CMD, so switch the test to make that explicit.
Signed-off-by: NRoland Dreier <roland@purestorage.com>
Acked-by: NChad Dupuis <chad.dupuis@qlogic.com>
Cc: stable@kernel.org
Signed-off-by: NJames Bottomley <JBottomley@Parallels.com>
上级 f72a209a
...@@ -1328,10 +1328,9 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) ...@@ -1328,10 +1328,9 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
qla2x00_sp_compl(ha, sp); qla2x00_sp_compl(ha, sp);
} else { } else {
ctx = sp->ctx; ctx = sp->ctx;
if (ctx->type == SRB_LOGIN_CMD || if (ctx->type == SRB_ELS_CMD_RPT ||
ctx->type == SRB_LOGOUT_CMD) { ctx->type == SRB_ELS_CMD_HST ||
ctx->u.iocb_cmd->free(sp); ctx->type == SRB_CT_CMD) {
} else {
struct fc_bsg_job *bsg_job = struct fc_bsg_job *bsg_job =
ctx->u.bsg_job; ctx->u.bsg_job;
if (bsg_job->request->msgcode if (bsg_job->request->msgcode
...@@ -1343,6 +1342,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res) ...@@ -1343,6 +1342,8 @@ qla2x00_abort_all_cmds(scsi_qla_host_t *vha, int res)
kfree(sp->ctx); kfree(sp->ctx);
mempool_free(sp, mempool_free(sp,
ha->srb_mempool); ha->srb_mempool);
} else {
ctx->u.iocb_cmd->free(sp);
} }
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册