diff mbox series

scsi: qedf: fix a memleak in qedf_alloc_global_queues

Message ID 20231227054255.28583-1-dinghao.liu@zju.edu.cn (mailing list archive)
State New, archived
Headers show
Series scsi: qedf: fix a memleak in qedf_alloc_global_queues | expand

Commit Message

Dinghao Liu Dec. 27, 2023, 5:42 a.m. UTC
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@zju.edu.cn>
---
 drivers/scsi/qedf/qedf_main.c | 1 +
 1 file changed, 1 insertion(+)
diff mbox series

Patch

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;
 }