Skip to content

Commit 60aaeff

Browse files
Leon Romanovskyjgunthorpe
authored andcommitted
RDMA/cma: Delete from restrack DB after successful destroy
Update the code to have similar destroy pattern like other IB objects. This change create asymmetry to the rdma_id_private create flow to make sure that memory is managed by restrack. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Leon Romanovsky <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent f5449e7 commit 60aaeff

File tree

1 file changed

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

1 file changed

+1
-2
lines changed

drivers/infiniband/core/cma.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1804,7 +1804,6 @@ static void _destroy_id(struct rdma_id_private *id_priv,
18041804
{
18051805
cma_cancel_operation(id_priv, state);
18061806

1807-
rdma_restrack_del(&id_priv->res);
18081807
if (id_priv->cma_dev) {
18091808
if (rdma_cap_ib_cm(id_priv->id.device, 1)) {
18101809
if (id_priv->cm_id.ib)
@@ -1830,6 +1829,7 @@ static void _destroy_id(struct rdma_id_private *id_priv,
18301829
rdma_put_gid_attr(id_priv->id.route.addr.dev_addr.sgid_attr);
18311830

18321831
put_net(id_priv->id.route.addr.dev_addr.net);
1832+
rdma_restrack_del(&id_priv->res);
18331833
kfree(id_priv);
18341834
}
18351835

@@ -3721,7 +3721,6 @@ int rdma_bind_addr(struct rdma_cm_id *id, struct sockaddr *addr)
37213721

37223722
return 0;
37233723
err2:
3724-
rdma_restrack_del(&id_priv->res);
37253724
if (id_priv->cma_dev)
37263725
cma_release_dev(id_priv);
37273726
err1:

0 commit comments

Comments
 (0)