Commit 2d338eb5 authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: Fix NULL ptr dereference with NPIV ports for RDF handling

RDF ELS handling for NPIV ports may result in an incorrect NDLP reference
count.  In the event of a persistent link down, this may lead to premature
release of an NDLP structure and subsequent NULL ptr dereference panic.

Remove extraneous lpfc_nlp_put() call in NPIV port RDF processing.

Link: https://lore.kernel.org/r/20210707184351.67872-9-jsmart2021@gmail.comCo-developed-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJustin Tee <justin.tee@broadcom.com>
Signed-off-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 4e670c8a
...@@ -3413,7 +3413,6 @@ lpfc_issue_els_scr(struct lpfc_vport *vport, uint8_t retry) ...@@ -3413,7 +3413,6 @@ lpfc_issue_els_scr(struct lpfc_vport *vport, uint8_t retry)
return 1; return 1;
} }
/* Keep the ndlp just in case RDF is being sent */
return 0; return 0;
} }
...@@ -3657,11 +3656,9 @@ lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t retry) ...@@ -3657,11 +3656,9 @@ lpfc_issue_els_rdf(struct lpfc_vport *vport, uint8_t retry)
lpfc_enqueue_node(vport, ndlp); lpfc_enqueue_node(vport, ndlp);
} }
/* RDF ELS is not required on an NPIV VN_Port. */ /* RDF ELS is not required on an NPIV VN_Port. */
if (vport->port_type == LPFC_NPIV_PORT) { if (vport->port_type == LPFC_NPIV_PORT)
lpfc_nlp_put(ndlp);
return -EACCES; return -EACCES;
}
elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp, elsiocb = lpfc_prep_els_iocb(vport, 1, cmdsize, retry, ndlp,
ndlp->nlp_DID, ELS_CMD_RDF); ndlp->nlp_DID, ELS_CMD_RDF);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment