diff mbox series

[06/22] lpfc: Fix lpfc_els_retry() possible null pointer dereference

Message ID 20210211234443.3107-7-jsmart2021@gmail.com
State Superseded
Headers show
Series lpfc: Update lpfc to revision 12.8.0.8 | expand

Commit Message

James Smart Feb. 11, 2021, 11:44 p.m. UTC
Driver crashed in lpfc_debugfs_disc_trc() due to null ndlp pointer.
In some calling cases, the ndlp is null and the did is looked up.

Fix by using the local did variable that is set appropriately based
on ndlp value.

Co-developed-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
 drivers/scsi/lpfc/lpfc_els.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 780b4c1e98eb..788cb5d9054c 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -3823,7 +3823,7 @@  lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 
 	lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
 		"Retry ELS:       wd7:x%x wd4:x%x did:x%x",
-		*(((uint32_t *) irsp) + 7), irsp->un.ulpWord[4], ndlp->nlp_DID);
+		*(((uint32_t *)irsp) + 7), irsp->un.ulpWord[4], did);
 
 	switch (irsp->ulpStatus) {
 	case IOSTAT_FCP_RSP_ERROR: