Skip to content

Commit 1854f53

Browse files
jsmart-ghmartinkpetersen
authored andcommitted
scsi: lpfc: Fix link down processing to address NULL pointer dereference
If an FC link down transition while PLOGIs are outstanding to fabric well known addresses, outstanding ABTS requests may result in a NULL pointer dereference. Driver unload requests may hang with repeated "2878" log messages. The Link down processing results in ABTS requests for outstanding ELS requests. The Abort WQEs are sent for the ELSs before the driver had set the link state to down. Thus the driver is sending the Abort with the expectation that an ABTS will be sent on the wire. The Abort request is stalled waiting for the link to come up. In some conditions the driver may auto-complete the ELSs thus if the link does come up, the Abort completions may reference an invalid structure. Fix by ensuring that Abort set the flag to avoid link traffic if issued due to conditions where the link failed. Link: https://lore.kernel.org/r/[email protected] Co-developed-by: Justin Tee <[email protected]> Signed-off-by: Justin Tee <[email protected]> Signed-off-by: James Smart <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent 15af02d commit 1854f53

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

drivers/scsi/lpfc/lpfc_sli.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12403,17 +12403,17 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
1240312403

1240412404
/* ABTS WQE must go to the same WQ as the WQE to be aborted */
1240512405
abtsiocbp->hba_wqidx = cmdiocb->hba_wqidx;
12406-
if (cmdiocb->iocb_flag & LPFC_IO_FCP) {
12407-
abtsiocbp->iocb_flag |= LPFC_IO_FCP;
12408-
abtsiocbp->iocb_flag |= LPFC_USE_FCPWQIDX;
12409-
}
12406+
if (cmdiocb->iocb_flag & LPFC_IO_FCP)
12407+
abtsiocbp->iocb_flag |= (LPFC_IO_FCP | LPFC_USE_FCPWQIDX);
1241012408
if (cmdiocb->iocb_flag & LPFC_IO_FOF)
1241112409
abtsiocbp->iocb_flag |= LPFC_IO_FOF;
1241212410

12413-
if (phba->link_state >= LPFC_LINK_UP)
12414-
iabt->ulpCommand = CMD_ABORT_XRI_CN;
12415-
else
12411+
if (phba->link_state < LPFC_LINK_UP ||
12412+
(phba->sli_rev == LPFC_SLI_REV4 &&
12413+
phba->sli4_hba.link_state.status == LPFC_FC_LA_TYPE_LINK_DOWN))
1241612414
iabt->ulpCommand = CMD_CLOSE_XRI_CN;
12415+
else
12416+
iabt->ulpCommand = CMD_ABORT_XRI_CN;
1241712417

1241812418
if (cmpl)
1241912419
abtsiocbp->iocb_cmpl = cmpl;

0 commit comments

Comments
 (0)