[ofa-general] [PATCH] opensm: protect sminfo response
Sasha Khapyorsky
sashak at voltaire.com
Tue Jun 5 08:28:03 PDT 2007
This port_guid check protects SMInfo responses processing against port
moving issue.
Signed-off-by: Sasha Khapyorsky <sashak at voltaire.com>
---
opensm/opensm/osm_port_info_rcv.c | 1 +
opensm/opensm/osm_sminfo_rcv.c | 19 +++++++++++++++++++
2 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/opensm/opensm/osm_port_info_rcv.c b/opensm/opensm/osm_port_info_rcv.c
index 849427e..1fd4915 100644
--- a/opensm/opensm/osm_port_info_rcv.c
+++ b/opensm/opensm/osm_port_info_rcv.c
@@ -199,6 +199,7 @@ __osm_pi_rcv_process_endport(
*/
memset( &context, 0, sizeof(context) );
context.smi_context.set_method = FALSE;
+ context.smi_context.port_guid = port_guid;
status = osm_req_get( p_rcv->p_req,
osm_physp_get_dr_path_ptr( p_physp ),
IB_MAD_ATTR_SM_INFO,
diff --git a/opensm/opensm/osm_sminfo_rcv.c b/opensm/opensm/osm_sminfo_rcv.c
index b26b6bf..18fd072 100644
--- a/opensm/opensm/osm_sminfo_rcv.c
+++ b/opensm/opensm/osm_sminfo_rcv.c
@@ -749,8 +749,26 @@ osm_sminfo_rcv_process(
*/
if( ib_smp_is_response( p_smp ) )
{
+ const ib_sm_info_t *p_smi = ib_smp_get_payload_ptr( p_smp );
+
/* Get the context - to see if this is a response to a Get or Set method */
p_smi_context = osm_madw_get_smi_context_ptr( p_madw );
+
+ /*
+ verify that response is from expected port and there is no port
+ moving issue */
+ if ( p_smi_context->port_guid != p_smi->guid )
+ {
+ osm_log( p_rcv->p_log, OSM_LOG_ERROR,
+ "osm_sminfo_rcv_process: ERR 2F19: "
+ "unexpected SM port GUID in response"
+ "\n\t\t\t\tExpected 0x%016" PRIx64
+ ", Received 0x%016" PRIx64 "\n",
+ cl_ntoh64( p_smi_context->port_guid ),
+ cl_ntoh64( p_smi->guid ) );
+ goto Exit;
+ }
+
if ( p_smi_context->set_method == FALSE )
{
/* this is a response to a Get method */
@@ -777,5 +795,6 @@ osm_sminfo_rcv_process(
}
}
+ Exit:
OSM_LOG_EXIT( p_rcv->p_log );
}
--
1.5.2.1.137.g426c
More information about the general
mailing list