Skip to contentSkip to conversation

lpfc: Fix additional reference counting in lpfc_bsg_rport_els()

PATCH Applied James Smart 2 participants 3 messages Apr 27, 2022 – May 4, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 lpfc: Fix additional reference counting in lpfc_bsg_rport_els()

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.

---
 drivers/scsi/lpfc/lpfc_bsg.c | 6 ------
 1 file changed, 6 deletions(-)
drivers/scsi/lpfc/lpfc_bsg.c +0 -6
index ae46383b13bf..676e7d54b97a 100644
@@ -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);
Signature · 1 line
2.26.2
#1 lore raw

James,

Quoted 3 lines

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!

Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering
#2 lore raw
In reply to James Smart
Quoted 8 lines · James Smart

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
Signature · 1 line
Martin K. Petersen	Oracle Linux Engineering