]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - releases/6.8.6/scsi-lpfc-fix-possible-memory-leak-in-lpfc_rcv_padis.patch
Linux 6.8.6
[thirdparty/kernel/stable-queue.git] / releases / 6.8.6 / scsi-lpfc-fix-possible-memory-leak-in-lpfc_rcv_padis.patch
CommitLineData
335f7cc0
SL
1From 66aa89818866286bdde02313dd91460080b7f1e6 Mon Sep 17 00:00:00 2001
2From: Sasha Levin <sashal@kernel.org>
3Date: Wed, 31 Jan 2024 10:50:57 -0800
4Subject: scsi: lpfc: Fix possible memory leak in lpfc_rcv_padisc()
5
6From: Justin Tee <justin.tee@broadcom.com>
7
8[ Upstream commit 2ae917d4bcab80ab304b774d492e2fcd6c52c06b ]
9
10The call to lpfc_sli4_resume_rpi() in lpfc_rcv_padisc() may return an
11unsuccessful status. In such cases, the elsiocb is not issued, the
12completion is not called, and thus the elsiocb resource is leaked.
13
14Check return value after calling lpfc_sli4_resume_rpi() and conditionally
15release the elsiocb resource.
16
17Signed-off-by: Justin Tee <justin.tee@broadcom.com>
18Link: https://lore.kernel.org/r/20240131185112.149731-3-justintee8345@gmail.com
19Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
20Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
21Signed-off-by: Sasha Levin <sashal@kernel.org>
22---
23 drivers/scsi/lpfc/lpfc_nportdisc.c | 6 ++++--
24 1 file changed, 4 insertions(+), 2 deletions(-)
25
26diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
27index d9074929fbab8..b147304b01fa1 100644
28--- a/drivers/scsi/lpfc/lpfc_nportdisc.c
29+++ b/drivers/scsi/lpfc/lpfc_nportdisc.c
30@@ -748,8 +748,10 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
31 /* Save the ELS cmd */
32 elsiocb->drvrTimeout = cmd;
33
34- lpfc_sli4_resume_rpi(ndlp,
35- lpfc_mbx_cmpl_resume_rpi, elsiocb);
36+ if (lpfc_sli4_resume_rpi(ndlp,
37+ lpfc_mbx_cmpl_resume_rpi,
38+ elsiocb))
39+ kfree(elsiocb);
40 goto out;
41 }
42 }
43--
442.43.0
45