[openib-general] [PATCH] rdma_bind_addr() leaks a cma_dev reference count
Sean Hefty
sean.hefty at intel.com
Wed Oct 18 09:43:29 PDT 2006
>Actually that will not work, since the undo operation is for when the
>next operation (cma_get_port()) fails after we did an acquire_dev,
>and in that case the refcount needs to be dropped. So I am not
>able to avoid using an extra flag to indicate that a ref was got some
>time in the past, and drop it in the error path. I will send that out now.
Let's try something like this then (untested):
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 18a4366..0d06431 100755
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1859,16 +1859,20 @@ int rdma_bind_addr(struct rdma_cm_id *id
mutex_unlock(&lock);
}
if (ret)
- goto err;
+ goto err1;
}
memcpy(&id->route.addr.src_addr, addr, ip_addr_size(addr));
ret = cma_get_port(id_priv);
if (ret)
- goto err;
+ goto err2;
return 0;
-err:
+err2:
+ mutex_lock(&lock);
+ cma_detach_from_dev(id_priv);
+ mutex_unlock(&lock);
+err1:
cma_comp_exch(id_priv, CMA_ADDR_BOUND, CMA_IDLE);
return ret;
}
- Sean
More information about the general
mailing list