Skip to content

Commit 2ae917d

Browse files
Justin Teemartinkpetersen
authored andcommitted
scsi: lpfc: Fix possible memory leak in lpfc_rcv_padisc()
The call to lpfc_sli4_resume_rpi() in lpfc_rcv_padisc() may return an unsuccessful status. In such cases, the elsiocb is not issued, the completion is not called, and thus the elsiocb resource is leaked. Check return value after calling lpfc_sli4_resume_rpi() and conditionally release the elsiocb resource. Signed-off-by: Justin Tee <justin.tee@broadcom.com> Link: https://lore.kernel.org/r/20240131185112.149731-3-justintee8345@gmail.com Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 3d0f934 commit 2ae917d

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/scsi/lpfc/lpfc_nportdisc.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -748,8 +748,10 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
748748
/* Save the ELS cmd */
749749
elsiocb->drvrTimeout = cmd;
750750

751-
lpfc_sli4_resume_rpi(ndlp,
752-
lpfc_mbx_cmpl_resume_rpi, elsiocb);
751+
if (lpfc_sli4_resume_rpi(ndlp,
752+
lpfc_mbx_cmpl_resume_rpi,
753+
elsiocb))
754+
kfree(elsiocb);
753755
goto out;
754756
}
755757
}

0 commit comments

Comments
 (0)