scsi: lpfc: add check for loss of ndlp when sending RRQ [Linux 4.14.128]

scsi: lpfc: add check for loss of ndlp when sending RRQ [Linux 4.14.128]

This Linux kernel change "scsi: lpfc: add check for loss of ndlp when sending RRQ" is included in the Linux 4.14.128 release. This change is authored by James Smart <jsmart2021 [at] gmail.com> on Mon May 6 17:26:49 2019 -0700. The commit for this change in Linux stable tree is 9bc0178 (patch) which is from upstream commit c8cb261. The same Linux upstream change may have been applied to various maintained Linux releases and you can find all Linux releases containing changes from upstream c8cb261.

scsi: lpfc: add check for loss of ndlp when sending RRQ

[ Upstream commit c8cb261a072c88ca1aff0e804a30db4c7606521b ]

There was a missing qualification of a valid ndlp structure when calling to
send an RRQ for an abort.  Add the check.

Signed-off-by: Dick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
Tested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>

There are 5 lines of Linux source code added/deleted in this change. Code changes to Linux kernel are as follows.

 drivers/scsi/lpfc/lpfc_els.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index 57cddbc..ddd2975 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -7065,7 +7065,10 @@ struct lpfc_iocbq *
 lpfc_send_rrq(struct lpfc_hba *phba, struct lpfc_node_rrq *rrq)
 {
    struct lpfc_nodelist *ndlp = lpfc_findnode_did(rrq->vport,
-                           rrq->nlp_DID);
+                              rrq->nlp_DID);
+   if (!ndlp)
+       return 1;
+
    if (lpfc_test_rrq_active(phba, ndlp, rrq->xritag))
        return lpfc_issue_els_rrq(rrq->vport, ndlp,
                     rrq->nlp_DID, rrq);

Leave a Reply

Your email address will not be published. Required fields are marked *