Skip to content

Commit 035840e

Browse files
committed
scsi: qedf: Fix a possible memory leak in qedf_alloc_and_init_sb()
JIRA: https://issues.redhat.com/browse/RHEL-72637 Hook "qed_ops->common->sb_init = qed_sb_init" does not release the DMA memory sb_virt when it fails. Add dma_free_coherent() to free it. This is the same way as qedr_alloc_mem_sb() and qede_alloc_mem_sb(). Fixes: 61d8658 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.") Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Link: https://lore.kernel.org/r/20241026125711.484-2-thunder.leizhen@huawei.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> (cherry picked from commit c62c304) Signed-off-by: John Meneghini <jmeneghi@redhat.com>
1 parent bbc4e23 commit 035840e

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/scsi/qedf/qedf_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2741,6 +2741,7 @@ static int qedf_alloc_and_init_sb(struct qedf_ctx *qedf,
27412741
sb_id, QED_SB_TYPE_STORAGE);
27422742

27432743
if (ret) {
2744+
dma_free_coherent(&qedf->pdev->dev, sizeof(*sb_virt), sb_virt, sb_phys);
27442745
QEDF_ERR(&qedf->dbg_ctx,
27452746
"Status block initialization failed (0x%x) for id = %d.\n",
27462747
ret, sb_id);

0 commit comments

Comments
 (0)