aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband
diff options
context:
space:
mode:
authorKrishna Kumar <krkumar2@in.ibm.com>2006-09-29 11:47:06 -0700
committerRoland Dreier <rolandd@cisco.com>2006-10-02 14:52:15 -0700
commit675a027c3db25a439f6ea744bb0c284f983dbfb9 (patch)
treecffaa17e8c330481dd8de893888ada6ce21cd0ef /drivers/infiniband
parent95f3eff6997ae4a6754c1d874ec0a414d97c44d1 (diff)
downloadkernel_samsung_espresso10-675a027c3db25a439f6ea744bb0c284f983dbfb9.zip
kernel_samsung_espresso10-675a027c3db25a439f6ea744bb0c284f983dbfb9.tar.gz
kernel_samsung_espresso10-675a027c3db25a439f6ea744bb0c284f983dbfb9.tar.bz2
RDMA/cma: Fix leak of cm_ids in case of failures
cma_connect_ib() and cma_connect_iw() leak cm_id's in failure cases. Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com> Signed-off-by: Sean Hefty <sean.hefty@intel.com> Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r--drivers/infiniband/core/cma.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 1178bd4..69bb089 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -1862,6 +1862,11 @@ static int cma_connect_ib(struct rdma_id_private *id_priv,
ret = ib_send_cm_req(id_priv->cm_id.ib, &req);
out:
+ if (ret && !IS_ERR(id_priv->cm_id.ib)) {
+ ib_destroy_cm_id(id_priv->cm_id.ib);
+ id_priv->cm_id.ib = NULL;
+ }
+
kfree(private_data);
return ret;
}
@@ -1889,10 +1894,8 @@ static int cma_connect_iw(struct rdma_id_private *id_priv,
cm_id->remote_addr = *sin;
ret = cma_modify_qp_rtr(&id_priv->id);
- if (ret) {
- iw_destroy_cm_id(cm_id);
- return ret;
- }
+ if (ret)
+ goto out;
iw_param.ord = conn_param->initiator_depth;
iw_param.ird = conn_param->responder_resources;
@@ -1904,6 +1907,10 @@ static int cma_connect_iw(struct rdma_id_private *id_priv,
iw_param.qpn = conn_param->qp_num;
ret = iw_cm_connect(cm_id, &iw_param);
out:
+ if (ret && !IS_ERR(cm_id)) {
+ iw_destroy_cm_id(cm_id);
+ id_priv->cm_id.iw = NULL;
+ }
return ret;
}