Skip to content

Commit c14dfdd

Browse files
committed
RMDA/cm: Fix missing ib_cm_destroy_id() in ib_cm_insert_listen()
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: 067b171 ("IB/cm: Share listening CM IDs") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 6affca1 commit c14dfdd

File tree

1 file changed

+1
-0
lines changed
  • drivers/infiniband/core

1 file changed

+1
-0
lines changed

drivers/infiniband/core/cm.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,7 @@ struct ib_cm_id *ib_cm_insert_listen(struct ib_device *device,
11911191
/* Sharing an ib_cm_id with different handlers is not
11921192
* supported */
11931193
spin_unlock_irqrestore(&cm.lock, flags);
1194+
ib_destroy_cm_id(cm_id);
11941195
return ERR_PTR(-EINVAL);
11951196
}
11961197
refcount_inc(&cm_id_priv->refcount);

0 commit comments

Comments
 (0)