[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251229071515.155412-3-zilin@seu.edu.cn>
Date: Mon, 29 Dec 2025 07:15:14 +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,
linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org,
jianhao.xu@....edu.cn,
Zilin Guan <zilin@....edu.cn>
Subject: [PATCH 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 bc2e55f6a50f..760e38b778fb 100644
--- a/drivers/scsi/lpfc/lpfc_init.c
+++ b/drivers/scsi/lpfc/lpfc_init.c
@@ -8297,6 +8297,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;
}
@@ -8308,6 +8309,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