[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251230145858.1356864-3-zilin@seu.edu.cn>
Date: Tue, 30 Dec 2025 14:58:57 +0000
From: Zilin Guan <zilin@....edu.cn>
To: justin.tee@...adcom.com
Cc: paul.ely@...adcom.com,
James.Bottomley@...senPartnership.com,
martin.petersen@...cle.com,
Markus.Elfring@....de,
jianhao.xu@....edu.cn,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
Zilin Guan <zilin@....edu.cn>
Subject: [PATCH v2 2/3] scsi: lpfc: Fix memory leak in lpfc_sli4_driver_resource_setup()
In lpfc_sli4_driver_resource_setup(), mboxq is allocated via
mempool_alloc() but is not freed when the allocation of
phba->lpfc_sg_dma_buf_pool or phba->lpfc_cmd_rsp_buf_pool fails.
Fix this by adding mempool_free() in the error paths.
Fixes: d79c9e9d4b3d ("scsi: lpfc: Support dynamic unbounded SGL lists on G7 hardware.")
Co-developed-by: Jianhao Xu <jianhao.xu@....edu.cn>
Signed-off-by: Jianhao Xu <jianhao.xu@....edu.cn>
Signed-off-by: Zilin Guan <zilin@....edu.cn>
---
drivers/scsi/lpfc/lpfc_init.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/scsi/lpfc/lpfc_init.c b/drivers/scsi/lpfc/lpfc_init.c
index 1390d2b5095d..54a8d290c2e1 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8295,6 +8295,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
i, 0);
if (!phba->lpfc_sg_dma_buf_pool) {
rc = -ENOMEM;
+ mempool_free(mboxq, phba->mbox_mem_pool);
goto out_free_bsmbx;
}
@@ -8306,6 +8307,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
i, 0);
if (!phba->lpfc_cmd_rsp_buf_pool) {
rc = -ENOMEM;
+ mempool_free(mboxq, phba->mbox_mem_pool);
goto out_free_sg_dma_buf;
}
--
2.34.1
Powered by blists - more mailing lists