From 6b61d4f20fe81e0022269b21c2ae4599dac3c73e Mon Sep 17 00:00:00 2001 From: leonidk Date: Wed, 22 Oct 2008 11:26:32 +0000 Subject: [PATCH] [IBBUS] fixed a potential crash [mlnx: 3183] 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@1675 ad392aa1-c5ef-ae45-8dd8-e69d62a5ef86 --- trunk/core/bus/kernel/bus_port_mgr.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/trunk/core/bus/kernel/bus_port_mgr.c b/trunk/core/bus/kernel/bus_port_mgr.c index cc62e0e6..e0c6b812 100644 --- a/trunk/core/bus/kernel/bus_port_mgr.c +++ b/trunk/core/bus/kernel/bus_port_mgr.c @@ -621,7 +621,15 @@ __port_was_hibernated( port_pnp_ctx_t *p_ctx = p_pnp_rec->pnp_rec.context; BUS_ENTER( BUS_DBG_PNP ); - + + if ( !gp_port_mgr ) { + // if free_port_mgr has been called , p_bfi->p_port_mgr == NULL + // this will cause crash on cl_mutex_acquire + // (leo) i'm not sure when it happens, but i saw it happened + status = IB_NOT_FOUND; + goto end; + } + cl_mutex_acquire( &gp_port_mgr->pdo_mutex ); /* Count the number of child devices. */ @@ -686,6 +694,7 @@ __port_was_hibernated( cl_mutex_release( &gp_port_mgr->pdo_mutex ); +end: BUS_EXIT( BUS_DBG_PNP ); return status; } -- 2.46.0