diff options
author | Krishna Kumar <krkumar2@in.ibm.com> | 2006-09-29 14:47:06 -0400 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2006-10-02 17:52:15 -0400 |
commit | 675a027c3db25a439f6ea744bb0c284f983dbfb9 (patch) | |
tree | cffaa17e8c330481dd8de893888ada6ce21cd0ef /drivers/infiniband | |
parent | 95f3eff6997ae4a6754c1d874ec0a414d97c44d1 (diff) |
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.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c index 1178bd434d1b..69bb0892e887 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, | |||
1862 | 1862 | ||
1863 | ret = ib_send_cm_req(id_priv->cm_id.ib, &req); | 1863 | ret = ib_send_cm_req(id_priv->cm_id.ib, &req); |
1864 | out: | 1864 | out: |
1865 | if (ret && !IS_ERR(id_priv->cm_id.ib)) { | ||
1866 | ib_destroy_cm_id(id_priv->cm_id.ib); | ||
1867 | id_priv->cm_id.ib = NULL; | ||
1868 | } | ||
1869 | |||
1865 | kfree(private_data); | 1870 | kfree(private_data); |
1866 | return ret; | 1871 | return ret; |
1867 | } | 1872 | } |
@@ -1889,10 +1894,8 @@ static int cma_connect_iw(struct rdma_id_private *id_priv, | |||
1889 | cm_id->remote_addr = *sin; | 1894 | cm_id->remote_addr = *sin; |
1890 | 1895 | ||
1891 | ret = cma_modify_qp_rtr(&id_priv->id); | 1896 | ret = cma_modify_qp_rtr(&id_priv->id); |
1892 | if (ret) { | 1897 | if (ret) |
1893 | iw_destroy_cm_id(cm_id); | 1898 | goto out; |
1894 | return ret; | ||
1895 | } | ||
1896 | 1899 | ||
1897 | iw_param.ord = conn_param->initiator_depth; | 1900 | iw_param.ord = conn_param->initiator_depth; |
1898 | iw_param.ird = conn_param->responder_resources; | 1901 | iw_param.ird = conn_param->responder_resources; |
@@ -1904,6 +1907,10 @@ static int cma_connect_iw(struct rdma_id_private *id_priv, | |||
1904 | iw_param.qpn = conn_param->qp_num; | 1907 | iw_param.qpn = conn_param->qp_num; |
1905 | ret = iw_cm_connect(cm_id, &iw_param); | 1908 | ret = iw_cm_connect(cm_id, &iw_param); |
1906 | out: | 1909 | out: |
1910 | if (ret && !IS_ERR(cm_id)) { | ||
1911 | iw_destroy_cm_id(cm_id); | ||
1912 | id_priv->cm_id.iw = NULL; | ||
1913 | } | ||
1907 | return ret; | 1914 | return ret; |
1908 | } | 1915 | } |
1909 | 1916 | ||