diff mbox series

lpfc: Fix additional reference counting in lpfc_bsg_rport_els()

Message ID 20220427222158.57867-1-jsmart2021@gmail.com (mailing list archive)
State Accepted
Headers show
Series lpfc: Fix additional reference counting in lpfc_bsg_rport_els() | expand

Commit Message

James Smart April 27, 2022, 10:21 p.m. UTC
Code inspection has found an additional reference is taken in
lpfc_bsg_rport_els(). Results in the ndlp not being freed thus is
leaked.

Fix by removing the redundant refcount taken before WQE submission.

Co-developed-by: Nigel Kirkland <nigel.kirkland@broadcom.com>
Signed-off-by: Nigel Kirkland <nigel.kirkland@broadcom.com>
Signed-off-by: James Smart <jsmart2021@gmail.com>
---
 drivers/scsi/lpfc/lpfc_bsg.c | 6 ------
 1 file changed, 6 deletions(-)

Comments

Martin K. Petersen April 28, 2022, 2:01 a.m. UTC | #1
James,

> Code inspection has found an additional reference is taken in
> lpfc_bsg_rport_els(). Results in the ndlp not being freed thus is
> leaked.

Applied to 5.19/scsi-staging, thanks!
Martin K. Petersen May 3, 2022, 12:51 a.m. UTC | #2
On Wed, 27 Apr 2022 15:21:58 -0700, James Smart wrote:

> Code inspection has found an additional reference is taken in
> lpfc_bsg_rport_els(). Results in the ndlp not being freed thus is
> leaked.
> 
> Fix by removing the redundant refcount taken before WQE submission.
> 
> 
> [...]

Applied to 5.19/scsi-queue, thanks!

[1/1] lpfc: Fix additional reference counting in lpfc_bsg_rport_els()
      https://git.kernel.org/mkp/scsi/c/92bd903da12b
diff mbox series

Patch

diff --git a/drivers/scsi/lpfc/lpfc_bsg.c b/drivers/scsi/lpfc/lpfc_bsg.c
index ae46383b13bf..676e7d54b97a 100644
--- a/drivers/scsi/lpfc/lpfc_bsg.c
+++ b/drivers/scsi/lpfc/lpfc_bsg.c
@@ -740,12 +740,6 @@  lpfc_bsg_rport_els(struct bsg_job *job)
 		readl(phba->HCregaddr); /* flush */
 	}
 
-	cmdiocbq->ndlp = lpfc_nlp_get(ndlp);
-	if (!cmdiocbq->ndlp) {
-		rc = -EIO;
-		goto linkdown_err;
-	}
-
 	rc = lpfc_sli_issue_iocb(phba, LPFC_ELS_RING, cmdiocbq, 0);
 	if (rc == IOCB_SUCCESS) {
 		spin_lock_irqsave(&phba->hbalock, flags);