Skip to content

Commit fc318ca

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Update phba link state conditional before sending CMF_SYNC_WQE
It's possible for the driver to send a CMF_SYNC_WQE to nonresponsive firmware during reset of the adapter. The phba link_state conditional check is currently a strict == LPFC_LINK_DOWN, which does not cover initialization states before reaching the LPFC_LINK_UP state. Update the phba->link_state conditional to < LPFC_LINK_UP so that all initialization states are covered before allowing sending CMF_SYNC_WQE. Update taking of the hbalock to be during this link_state check as well. Signed-off-by: Justin Tee <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 93bcc5f commit fc318ca

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,12 +1940,15 @@ lpfc_issue_cmf_sync_wqe(struct lpfc_hba *phba, u32 ms, u64 total)
19401940
atot = atomic_xchg(&phba->cgn_sync_alarm_cnt, 0);
19411941
wtot = atomic_xchg(&phba->cgn_sync_warn_cnt, 0);
19421942

1943+
spin_lock_irqsave(&phba->hbalock, iflags);
1944+
19431945
/* ONLY Managed mode will send the CMF_SYNC_WQE to the HBA */
19441946
if (phba->cmf_active_mode != LPFC_CFG_MANAGED ||
1945-
phba->link_state == LPFC_LINK_DOWN)
1946-
return 0;
1947+
phba->link_state < LPFC_LINK_UP) {
1948+
ret_val = 0;
1949+
goto out_unlock;
1950+
}
19471951

1948-
spin_lock_irqsave(&phba->hbalock, iflags);
19491952
sync_buf = __lpfc_sli_get_iocbq(phba);
19501953
if (!sync_buf) {
19511954
lpfc_printf_log(phba, KERN_ERR, LOG_CGN_MGMT,

0 commit comments

Comments
 (0)