* [PATCH] RMDA/cm: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen()
@ 2020-02-21 15:20 Jason Gunthorpe
2020-02-27 20:45 ` Jason Gunthorpe
0 siblings, 1 reply; 2+ messages in thread
From: Jason Gunthorpe @ 2020-02-21 15:20 UTC (permalink / raw)
To: linux-rdma
The algorithm pre-allocates a cm_id since allocation cannot be done while
holding the cm.lock spinlock, however it doesn't free it on one error
path, leading to a memory leak.
Fixes: 067b171b8679 ("IB/cm: Share listening CM IDs")
Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
---
drivers/infiniband/core/cm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/infiniband/core/cm.c b/drivers/infiniband/core/cm.c
index bfe97bae91ce0d..c8fe74f6394faa 100644
--- a/drivers/infiniband/core/cm.c
+++ b/drivers/infiniband/core/cm.c
@@ -1191,6 +1191,7 @@ struct ib_cm_id *ib_cm_insert_listen(struct ib_device *device,
/* Sharing an ib_cm_id with different handlers is not
* supported */
spin_unlock_irqrestore(&cm.lock, flags);
+ ib_destroy_cm_id(cm_id);
return ERR_PTR(-EINVAL);
}
refcount_inc(&cm_id_priv->refcount);
--
2.25.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] RMDA/cm: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen()
2020-02-21 15:20 [PATCH] RMDA/cm: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen() Jason Gunthorpe
@ 2020-02-27 20:45 ` Jason Gunthorpe
0 siblings, 0 replies; 2+ messages in thread
From: Jason Gunthorpe @ 2020-02-27 20:45 UTC (permalink / raw)
To: linux-rdma
On Fri, Feb 21, 2020 at 03:20:26PM +0000, Jason Gunthorpe wrote:
> The algorithm pre-allocates a cm_id since allocation cannot be done while
> holding the cm.lock spinlock, however it doesn't free it on one error
> path, leading to a memory leak.
>
> Fixes: 067b171b8679 ("IB/cm: Share listening CM IDs")
> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
> ---
> drivers/infiniband/core/cm.c | 1 +
> 1 file changed, 1 insertion(+)
Applied to for-rc
Jason
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2020-02-27 20:45 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-21 15:20 [PATCH] RMDA/cm: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen() Jason Gunthorpe
2020-02-27 20:45 ` Jason Gunthorpe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).