[openib-general] [PATCH] OpenSM/osm_sa_sminfo_record.c: In osm_smir_rcv_process, move pkey match to be ahead of allocating response MAD which actually eliminates the leak of the response MAD on pkey not matching

Hal Rosenstock halr at voltaire.com
Wed Jul 5 11:15:04 PDT 2006


OpenSM/osm_sa_sminfo_record.c: In osm_smir_rcv_process, move pkey match
to be ahead of allocating response MAD which actually eliminates the
leak of the response MAD on pkey not matching

Signed-off-by: Hal Rosenstock <halr at voltaire.com>

Index: opensm/osm_sa_sminfo_record.c
===================================================================
--- opensm/osm_sa_sminfo_record.c	(revision 8391)
+++ opensm/osm_sa_sminfo_record.c	(working copy)
@@ -172,6 +172,19 @@ osm_smir_rcv_process(
     goto Exit;
   }
 
+  /* check the matching of pkeys with the local physp the SM is on. */
+  local_guid = p_rcv->p_subn->sm_port_guid;
+  local_port = (osm_port_t*)cl_qmap_get( &p_rcv->p_subn->port_guid_tbl, local_guid );
+  if (FALSE ==
+      osm_physp_share_pkey( p_rcv->p_log, p_req_physp,
+                            osm_port_get_default_phys_ptr( local_port ) ) )
+  {
+    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
+            "osm_smir_rcv_process: ERR 2802: "
+            "Cannot get SMInfo record due to pkey violation\n" );
+    goto Exit;
+  }
+
   /*  
    *  Get a MAD to reply. Address of Mad is in the received mad_wrapper
    */
@@ -187,19 +200,6 @@ osm_smir_rcv_process(
     goto Exit;
   }
 
-  /* check the matching of pkeys with the local physp the SM is on. */
-  local_guid = p_rcv->p_subn->sm_port_guid;
-  local_port = (osm_port_t*)cl_qmap_get( &p_rcv->p_subn->port_guid_tbl, local_guid );
-  if (FALSE ==
-      osm_physp_share_pkey( p_rcv->p_log, p_req_physp,
-                            osm_port_get_default_phys_ptr( local_port ) ) )
-  {
-    osm_log(p_rcv->p_log, OSM_LOG_ERROR,
-            "osm_smir_rcv_process: ERR 2802: "
-            "Cannot get SMInfo record due to pkey violation\n" );
-    goto Exit;
-  }
-
   p_resp_sa_mad = osm_madw_get_sa_mad_ptr( p_resp_madw );
   p_resp_sminfo_rec =
     (ib_sminfo_record_t*)ib_sa_mad_get_payload_ptr( p_resp_sa_mad );







More information about the general mailing list