[PATCH] scsi: qedf: fix a memleak in qedf_alloc_global_queues

From: Dinghao Liu
Date: Wed Dec 27 2023 - 00:44:03 EST


When qedf_alloc_bdq() fails, qedf->global_queues should
be freed to prevent potential memleak. It's the same for
the following error handling paths.

Fixes: 61d8658b4a43 ("scsi: qedf: Add QLogic FastLinQ offload FCoE driver framework.")
Signed-off-by: Dinghao Liu <dinghao.liu@xxxxxxxxxx>
---
drivers/scsi/qedf/qedf_main.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/scsi/qedf/qedf_main.c b/drivers/scsi/qedf/qedf_main.c
index a58353b7b4e8..2261efcf2dbb 100644
--- a/drivers/scsi/qedf/qedf_main.c
+++ b/drivers/scsi/qedf/qedf_main.c
@@ -3155,6 +3155,7 @@ static int qedf_alloc_global_queues(struct qedf_ctx *qedf)

mem_alloc_failure:
qedf_free_global_queues(qedf);
+ kfree(qedf->global_queues);
return status;
}

--
2.17.1