]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
RDMA/ionic: Fix memory leak of admin q_wr
authorAbhijit Gangurde <abhijit.gangurde@amd.com>
Wed, 24 Sep 2025 14:21:23 +0000 (19:51 +0530)
committerJason Gunthorpe <jgg@nvidia.com>
Fri, 26 Sep 2025 16:12:56 +0000 (13:12 -0300)
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")
Link: https://patch.msgid.link/r/20250924142123.18344-1-abhijit.gangurde@amd.com
Signed-off-by: Abhijit Gangurde <abhijit.gangurde@amd.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/hw/ionic/ionic_admin.c

index c2ff21bcd96f5ccc0dcd2ed046204b6edbf5a243..2537aa55d12d7d2bacee648a8e07ffd5e421632b 100644 (file)
@@ -600,6 +600,7 @@ err_q:
 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);
 }