[SRP] fixes the BSOD when SRPT disconnects.
[mirror/winof/.git] / ulp / srp / kernel / srp_connection.c
index 303738a..1cccb7c 100644 (file)
@@ -288,23 +288,25 @@ __srp_cm_dreq_cb(
 {\r
        srp_session_t   *p_srp_session = (srp_session_t* VOID_PTR64)p_cm_dreq_rec->qp_context;\r
        srp_hba_t       *p_hba = p_srp_session->p_hba;\r
 {\r
        srp_session_t   *p_srp_session = (srp_session_t* VOID_PTR64)p_cm_dreq_rec->qp_context;\r
        srp_hba_t       *p_hba = p_srp_session->p_hba;\r
-       ib_cm_drep_t    cm_drep;\r
-       ib_api_status_t status;\r
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
        cl_obj_lock( &p_srp_session->obj );\r
 \r
        SRP_ENTER( SRP_DBG_PNP );\r
 \r
        cl_obj_lock( &p_srp_session->obj );\r
-       p_srp_session->connection.state = SRP_CONNECT_FAILURE;\r
-       cl_obj_unlock( &p_srp_session->obj );\r
-\r
-       cm_drep.p_drep_pdata = NULL;\r
-       cm_drep.drep_length = 0;\r
 \r
 \r
-       status = p_hba->ifc.cm_drep( p_cm_dreq_rec->h_cm_dreq, &cm_drep );\r
-       if ( status != IB_SUCCESS )\r
+       if (p_srp_session->connection.state == SRP_CONNECTED)\r
        {\r
        {\r
-               SRP_PRINT( TRACE_LEVEL_ERROR, SRP_DBG_ERROR,\r
-                       ("Cannot respond to target disconnect request. Status = %d\n", status) );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_PNP,\r
+                       ("**** SRP_CONNECTED => SRP_CONNECT_FAILURE. \n") );\r
+               p_srp_session->connection.state = SRP_CONNECT_FAILURE;\r
+               cl_obj_unlock( &p_srp_session->obj );\r
+       }\r
+       else  // since the connection is no longer there, just exit\r
+       {\r
+               cl_obj_unlock( &p_srp_session->obj );\r
+               SRP_PRINT( TRACE_LEVEL_VERBOSE, SRP_DBG_PNP,\r
+                       ("**** NOT SRP_CONNECTED *****. connection state = %d\n", p_srp_session->connection.state) );\r
+               SRP_EXIT( SRP_DBG_PNP );\r
+               return; \r
        }\r
 \r
        SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_PNP,\r
        }\r
 \r
        SRP_PRINT( TRACE_LEVEL_WARNING, SRP_DBG_PNP,\r