Skip to content

Commit 1bd2862

Browse files
Abdun Nihaalmartinkpetersen
authored andcommitted
scsi: lpfc: Fix memory leak in lpfc_sli4_driver_resource_setup()
The memory allocated for mboxq using mempool_alloc() is not freed in some of the early exit error paths. Fix that by moving the mempool_free() call to an earlier point after last use. Fixes: d79c9e9 ("scsi: lpfc: Support dynamic unbounded SGL lists on G7 hardware.") Cc: stable@vger.kernel.org Signed-off-by: Abdun Nihaal <nihaal@cse.iitm.ac.in> Reviewed-by: Justin Tee <justin.tee@broadcom.com> Link: https://patch.msgid.link/20260707065304.949135-1-nihaal@cse.iitm.ac.in Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent 1d3a742 commit 1bd2862

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

drivers/scsi/lpfc/lpfc_init.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8189,6 +8189,7 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
81898189
mempool_free(mboxq, phba->mbox_mem_pool);
81908190
goto out_free_bsmbx;
81918191
}
8192+
mempool_free(mboxq, phba->mbox_mem_pool);
81928193

81938194
/*
81948195
* 1 for cmd, 1 for rsp, NVME adds an extra one
@@ -8311,8 +8312,6 @@ lpfc_sli4_driver_resource_setup(struct lpfc_hba *phba)
83118312
goto out_free_sg_dma_buf;
83128313
}
83138314

8314-
mempool_free(mboxq, phba->mbox_mem_pool);
8315-
83168315
/* Verify OAS is supported */
83178316
lpfc_sli4_oas_verify(phba);
83188317

0 commit comments

Comments
 (0)