From: Martin Wilck <mwilck@xxxxxxxx> Since commit 45235022da99 ("scsi: qla2xxx: Fix driver unload by shutting down chip"), it is possible that FC commands are scheduled after the adapter firmware has been shut down. IO sent to the firmware in this situation hangs indefinitely. Avoid this for the LOGO code path that is typically taken when adapters are shut down. Fixes: 45235022da99 ("scsi: qla2xxx: Fix driver unload by shutting down chip") Signed-off-by: Martin Wilck <mwilck@xxxxxxxx> Reviewed-by: Roman Bolshakov <r.bolshakov@xxxxxxxxx> --- drivers/scsi/qla2xxx/qla_mbx.c | 3 +++ drivers/scsi/qla2xxx/qla_os.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/drivers/scsi/qla2xxx/qla_mbx.c b/drivers/scsi/qla2xxx/qla_mbx.c index 9e09964..53129f2 100644 --- a/drivers/scsi/qla2xxx/qla_mbx.c +++ b/drivers/scsi/qla2xxx/qla_mbx.c @@ -2644,6 +2644,9 @@ qla24xx_fabric_logout(scsi_qla_host_t *vha, uint16_t loop_id, uint8_t domain, ql_dbg(ql_dbg_mbx + ql_dbg_verbose, vha, 0x106d, "Entered %s.\n", __func__); + if (!ha->flags.fw_started) + return QLA_FUNCTION_FAILED; + lg = dma_pool_zalloc(ha->s_dma_pool, GFP_KERNEL, &lg_dma); if (lg == NULL) { ql_log(ql_log_warn, vha, 0x106e, diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c index b520a98..2dafb46 100644 --- a/drivers/scsi/qla2xxx/qla_os.c +++ b/drivers/scsi/qla2xxx/qla_os.c @@ -4878,6 +4878,9 @@ qla2x00_post_work(struct scsi_qla_host *vha, struct qla_work_evt *e) unsigned long flags; bool q = false; + if (!vha->hw->flags.fw_started) + return QLA_FUNCTION_FAILED; + spin_lock_irqsave(&vha->work_lock, flags); list_add_tail(&e->list, &vha->work_list); -- 2.25.0