]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-6.6/scsi-lpfc-fix-possible-memory-leak-in-lpfc_rcv_padis.patch
Linux 6.1.86
[thirdparty/kernel/stable-queue.git] / queue-6.6 / scsi-lpfc-fix-possible-memory-leak-in-lpfc_rcv_padis.patch
1 From 33285f9a523f02bd7fcbd2f095f8083904da82d9 Mon Sep 17 00:00:00 2001
2 From: Sasha Levin <sashal@kernel.org>
3 Date: Wed, 31 Jan 2024 10:50:57 -0800
4 Subject: scsi: lpfc: Fix possible memory leak in lpfc_rcv_padisc()
5
6 From: Justin Tee <justin.tee@broadcom.com>
7
8 [ Upstream commit 2ae917d4bcab80ab304b774d492e2fcd6c52c06b ]
9
10 The call to lpfc_sli4_resume_rpi() in lpfc_rcv_padisc() may return an
11 unsuccessful status. In such cases, the elsiocb is not issued, the
12 completion is not called, and thus the elsiocb resource is leaked.
13
14 Check return value after calling lpfc_sli4_resume_rpi() and conditionally
15 release the elsiocb resource.
16
17 Signed-off-by: Justin Tee <justin.tee@broadcom.com>
18 Link: https://lore.kernel.org/r/20240131185112.149731-3-justintee8345@gmail.com
19 Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com>
20 Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
21 Signed-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
26 diff --git a/drivers/scsi/lpfc/lpfc_nportdisc.c b/drivers/scsi/lpfc/lpfc_nportdisc.c
27 index 1eb7f7e60bba5..3ed211d093dd1 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 --
44 2.43.0
45