]> git.openfabrics.org - ~shefty/rdma-win.git/commitdiff
[IBBUS] fixed a potential crash [mlnx: 3183]
authorleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 22 Oct 2008 11:22:38 +0000 (11:22 +0000)
committerleonidk <leonidk@ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86>
Wed, 22 Oct 2008 11:22:38 +0000 (11:22 +0000)
The behavior of IBBUS filter driver is still not stable in various restart scenarios.
This patch is a workaround for a bug, that causes a crash.

git-svn-id: svn://openib.tc.cornell.edu/gen1@1673 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86

branches/WOF2-0/trunk/core/bus/kernel/bus_port_mgr.c

index cc62e0e6226a5f09a358cff92c8059499e230d37..e0c6b8126dfacfa16a29ff6d24e997825d1c7d3b 100644 (file)
@@ -621,7 +621,15 @@ __port_was_hibernated(
        port_pnp_ctx_t  *p_ctx = p_pnp_rec->pnp_rec.context;\r
 \r
        BUS_ENTER( BUS_DBG_PNP );\r
-       \r
+\r
+       if ( !gp_port_mgr ) {\r
+               // if free_port_mgr has been called , p_bfi->p_port_mgr == NULL \r
+               // this will cause crash on cl_mutex_acquire\r
+               // (leo) i'm not sure when it happens, but i saw it happened\r
+               status = IB_NOT_FOUND;\r
+               goto end;\r
+       }\r
+\r
        cl_mutex_acquire( &gp_port_mgr->pdo_mutex );\r
        \r
        /* Count the number of child devices. */\r
@@ -686,6 +694,7 @@ __port_was_hibernated(
 \r
        cl_mutex_release( &gp_port_mgr->pdo_mutex );\r
 \r
+end:\r
        BUS_EXIT( BUS_DBG_PNP );\r
        return status;\r
 }\r