Skip to content

Commit 95bbdca

Browse files
Zhen Leimartinkpetersen
authored andcommitted
scsi: qedi: Fix a possible memory leak in qedi_alloc_and_init_sb()
Hook "qedi_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: ace7f46 ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.") Signed-off-by: Zhen Lei <thunder.leizhen@huawei.com> Link: https://lore.kernel.org/r/20241026125711.484-3-thunder.leizhen@huawei.com Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
1 parent c62c304 commit 95bbdca

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/scsi/qedi/qedi_main.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ static int qedi_alloc_and_init_sb(struct qedi_ctx *qedi,
369369
ret = qedi_ops->common->sb_init(qedi->cdev, sb_info, sb_virt, sb_phys,
370370
sb_id, QED_SB_TYPE_STORAGE);
371371
if (ret) {
372+
dma_free_coherent(&qedi->pdev->dev, sizeof(*sb_virt), sb_virt, sb_phys);
372373
QEDI_ERR(&qedi->dbg_ctx,
373374
"Status block initialization failed for id = %d.\n",
374375
sb_id);

0 commit comments

Comments
 (0)