All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lpfc: Fix additional reference counting in lpfc_bsg_rport_els()
@ 2022-04-27 22:21 James Smart
  2022-04-28  2:01 ` Martin K. Petersen
  2022-05-03  0:51 ` Martin K. Petersen
  0 siblings, 2 replies; 3+ messages in thread
From: James Smart @ 2022-04-27 22:21 UTC (permalink / raw)
  To: linux-scsi; +Cc: James Smart, Nigel Kirkland

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(-)

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);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-05-04  1:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-27 22:21 [PATCH] lpfc: Fix additional reference counting in lpfc_bsg_rport_els() James Smart
2022-04-28  2:01 ` Martin K. Petersen
2022-05-03  0:51 ` Martin K. Petersen

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.