Skip to contentSkip to conversation

RDMA/ionic: Fix memory leak of admin q_wr

PATCH Applied Abhijit Gangurde 2 participants 2 messages Sep 24, 2025 – Sep 26, 2025

Subsystems (2)
lore
Share & tools
lore

Abhijit Gangurde

author maintainer
#0 lore raw

PATCH 1/1 RDMA/ionic: Fix memory leak of admin q_wr

The admin queue work request buffer, aq->q_wr, is allocated via kcalloc in __ionic_create_rdma_adminq. However, it was not being freed in the corresponding teardown function __ionic_destroy_rdma_adminq. This results in a memory leak. Fix this leak by adding the missing kfree(aq->q_wr) in the destruction path.

Fixes f3bdbd42702c ("RDMA/ionic: Create device queues to support admin operations")
---
 drivers/infiniband/hw/ionic/ionic_admin.c | 1 +
 1 file changed, 1 insertion(+)
drivers/infiniband/hw/ionic/ionic_admin.c +1 -0
index c2ff21bcd96f..2537aa55d12d 100644
@@ -600,6 +600,7 @@ static struct ionic_aq *__ionic_create_rdma_adminq(struct ionic_ibdev *dev,
 static void __ionic_destroy_rdma_adminq(struct ionic_ibdev *dev,
 					struct ionic_aq *aq)
 {
+	kfree(aq->q_wr);
 	ionic_queue_destroy(&aq->q, dev->lif_cfg.hwdev);
 	kfree(aq);
 }

base-commit: 9b9e32f75aa3d257e3ee3ab0a0f9ad5fbfb298af

Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 7 lines · Abhijit Gangurde

The admin queue work request buffer, aq->q_wr, is allocated via kcalloc in __ionic_create_rdma_adminq. However, it was not being freed in the corresponding teardown function __ionic_destroy_rdma_adminq. This results in a memory leak. Fix this leak by adding the missing kfree(aq->q_wr) in the destruction path.

Quoted 5 lines
Fixes f3bdbd42702c ("RDMA/ionic: Create device queues to support admin operations")
---
 drivers/infiniband/hw/ionic/ionic_admin.c | 1 +
 1 file changed, 1 insertion(+)

Applied to for-next, thanks

Jason