[PATCH] scsi: qedi: Fix potential PF parameter leaks on allocation failure
From: Guangshuo Li
Date: Fri Nov 13 2026 - 14:04:57 EST
If global queue allocation fails, the caller skips PF parameter cleanup.
The CPU queue DMA buffer and the global queue pointer array can remain
allocated. Release them after the partial queues have been unwound.
This issue was found by our static analysis tool under development.
Fixes: ace7f46ba5fd ("scsi: qedi: Add QLogic FastLinQ offload iSCSI driver framework.")
Signed-off-by: Guangshuo Li <liguangshuo@xxxxxxxxxxxxxxx>
---
drivers/scsi/qedi/qedi_main.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/scsi/qedi/qedi_main.c b/drivers/scsi/qedi/qedi_main.c
index f394fcbb97e7..c73f9769549e 100644
--- a/drivers/scsi/qedi/qedi_main.c
+++ b/drivers/scsi/qedi/qedi_main.c
@@ -854,6 +854,12 @@ static int qedi_set_iscsi_pf_param(struct qedi_ctx *qedi)
rval = qedi_alloc_global_queues(qedi);
if (rval) {
QEDI_ERR(&qedi->dbg_ctx, "Global queue allocation failed.\n");
+ dma_free_coherent(&qedi->pdev->dev,
+ qedi->num_queues * sizeof(struct qedi_glbl_q_params),
+ qedi->p_cpuq, qedi->hw_p_cpuq);
+ qedi->p_cpuq = NULL;
+ kfree(qedi->global_queues);
+ qedi->global_queues = NULL;
rval = -1;
goto err_alloc_mem;
}
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4