[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200821081013.4762-1-dinghao.liu@zju.edu.cn>
Date: Fri, 21 Aug 2020 16:10:11 +0800
From: Dinghao Liu <dinghao.liu@....edu.cn>
To: dinghao.liu@....edu.cn, kjlu@....edu
Cc: Doug Ledford <dledford@...hat.com>, Jason Gunthorpe <jgg@...pe.ca>,
Yishai Hadas <yishaih@...lanox.com>,
Leon Romanovsky <leon@...nel.org>,
Michel Lespinasse <walken@...gle.com>,
Ariel Elior <ariel.elior@...vell.com>,
Michal Kalderon <michal.kalderon@...vell.com>,
linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] IB/uverbs: Fix memleak in ib_uverbs_add_one
When ida_alloc_max() fails, uverbs_dev should be freed
just like when init_srcu_struct() fails. It's the same
for the error paths after this call.
Signed-off-by: Dinghao Liu <dinghao.liu@....edu.cn>
---
drivers/infiniband/core/uverbs_main.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/core/uverbs_main.c b/drivers/infiniband/core/uverbs_main.c
index 37794d88b1f3..c6b4e3e2aff6 100644
--- a/drivers/infiniband/core/uverbs_main.c
+++ b/drivers/infiniband/core/uverbs_main.c
@@ -1170,6 +1170,7 @@ static int ib_uverbs_add_one(struct ib_device *device)
ib_uverbs_comp_dev(uverbs_dev);
wait_for_completion(&uverbs_dev->comp);
put_device(&uverbs_dev->dev);
+ kfree(uverbs_dev);
return ret;
}
--
2.17.1
Powered by blists - more mailing lists