[MLX4] fixed application crash in case of IOCTL failure. [mlnx:3498]
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 27 Nov 2008 13:29:24 +0000 (13:29 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Thu, 27 Nov 2008 13:29:24 +0000 (13:29 +0000)
git-svn-id: svn://openib.tc.cornell.edu/gen1/trunk@1772 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

core/al/user/ual_cq.c
hw/mlx4/user/hca/verbs.c
hw/mthca/user/mlnx_ual_cq.c

index 46aea61..5e7116d 100644 (file)
@@ -162,19 +162,6 @@ ual_create_cq(
                h_cq->h_rearm_n_cq = h_cq;\r
        }\r
 \r
-       if( status != IB_SUCCESS )\r
-       {\r
-               CL_ASSERT( !h_cq->h_ci_cq );\r
-               /*\r
-                * If we failed to create the CQ in the kernel, clear the h_ci_cq\r
-                * pointer to prevent trying to clean it up later.  This is needed\r
-                * to work-around the uVPD incorrectly setting the handle in the\r
-                * post_create_cq call even in the case of a failure.\r
-                */\r
-               /* TODO: Fix the UVP. */\r
-               h_cq->h_ci_cq = NULL;\r
-       }\r
-\r
        AL_EXIT( AL_DBG_CQ );\r
        return status;\r
 }\r
index c914cce..a39de5a 100644 (file)
@@ -96,6 +96,7 @@ mlx4_post_open_ca (
                if (!mlx4_fill_context(context, p_resp))\r
                {\r
                        status = IB_INSUFFICIENT_RESOURCES;\r
+                       *ph_uvp_ca = NULL;\r
                        goto end;\r
                }\r
        }\r
@@ -115,6 +116,7 @@ mlx4_post_close_ca (
        CL_ASSERT(context);\r
 \r
        if (IB_SUCCESS == ioctl_status)\r
+               \r
                mlx4_free_context(context);\r
 \r
        return IB_SUCCESS;\r
@@ -185,6 +187,7 @@ mlx4_post_alloc_pd (
        else\r
        {\r
                cl_free(to_mpd(pd));\r
+               *ph_uvp_pd = NULL;\r
        }\r
        \r
        cl_free(p_resp);\r
@@ -329,6 +332,7 @@ mlx4_post_create_cq (
        else\r
        {\r
                mlx4_post_destroy_cq (*ph_uvp_cq, IB_SUCCESS);\r
+               *ph_uvp_cq = NULL;\r
        }\r
        \r
        cl_free(p_resp);\r
@@ -489,6 +493,7 @@ mlx4_post_create_srq (
        else\r
        {\r
                mlx4_post_destroy_srq (*ph_uvp_srq, IB_SUCCESS);\r
+               *ph_uvp_srq = NULL;\r
        }\r
 \r
        cl_free(p_resp);\r
@@ -813,6 +818,7 @@ mlx4_post_create_qp (
        else\r
        {\r
                mlx4_post_destroy_qp(*ph_uvp_qp, IB_SUCCESS);\r
+               *ph_uvp_qp = NULL;\r
        }\r
 \r
        cl_free(p_resp);\r
@@ -1143,9 +1149,7 @@ mlx4_pre_create_ah (
 \r
        // convert parameters \r
        cl_memset(&attr, 0, sizeof(attr));\r
-       status = __to_ah(p_av_attr, &attr);\r
-       if (status)\r
-               goto end;\r
+       __to_ah(p_av_attr, &attr);\r
 \r
        ah->ibv_ah.pd = pd;\r
        ah->ibv_ah.context = pd->context;\r
@@ -1361,6 +1365,7 @@ mlx4_post_create_xrc_srq (
        else\r
        {\r
                mlx4_post_destroy_srq (*ph_uvp_srq, IB_SUCCESS);\r
+               *ph_uvp_srq = NULL;\r
        }\r
 \r
        cl_free( p_resp );\r
@@ -1442,6 +1447,7 @@ mlx4_post_open_xrc_domain (
        else\r
        {\r
                cl_free(to_mxrcd(xrcd));\r
+               *ph_uvp_xrcd = NULL;\r
        }\r
        \r
        cl_free(p_resp);\r
index a99c6e7..28f223d 100644 (file)
@@ -57,8 +57,6 @@ __pre_create_cq (
        struct ibv_create_cq *p_create_cq;\r
        int err;\r
 \r
-       UNREFERENCED_PARAMETER(ph_uvp_cq);\r
-\r
        UVP_ENTER(UVP_DBG_CQ);\r
 \r
        CL_ASSERT(p_umv_buf);\r
@@ -83,6 +81,7 @@ __pre_create_cq (
                goto err_alloc_cq;\r
        }\r
 \r
+       *ph_uvp_cq = (ib_cq_handle_t)(ULONG_PTR)p_create_cq->user_handle;\r
        goto end;\r
                \r
 err_alloc_cq:\r
@@ -128,11 +127,14 @@ __post_create_cq (
 \r
                *ph_uvp_cq = (ib_cq_handle_t)ibv_cq;\r
        }\r
-       goto end;\r
+       else {\r
+               ibv_cq = (struct ibv_cq *)*ph_uvp_cq;\r
+               ibv_cq->context = h_uvp_ca->ibv_ctx;\r
+               ibv_cq->context->ops.destroy_cq( ibv_cq );\r
+               *ph_uvp_cq = NULL;\r
+       }\r
 \r
-       p_hobul->ibv_ctx->ops.destroy_cq(ibv_cq);\r
 err_create_cq:\r
-end:   \r
        if (p_resp)\r
                cl_free( p_resp );\r
        UVP_EXIT(UVP_DBG_CQ);\r