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

* Re: [PATCH] lpfc: Fix additional reference counting in lpfc_bsg_rport_els()
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-04-28  2:01 UTC (permalink / raw)
  To: James Smart; +Cc: linux-scsi, Nigel Kirkland


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	Oracle Linux Engineering

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

* Re: [PATCH] lpfc: Fix additional reference counting in lpfc_bsg_rport_els()
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Martin K. Petersen @ 2022-05-03  0:51 UTC (permalink / raw)
  To: James Smart, linux-scsi; +Cc: Martin K . Petersen, Nigel Kirkland

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

-- 
Martin K. Petersen	Oracle Linux Engineering

^ permalink raw reply	[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.