svn commit: r364991 - head/contrib/ofed/opensm/opensm

Eric van Gyzen vangyzen at FreeBSD.org
Mon Aug 31 15:26:02 UTC 2020


Author: vangyzen
Date: Mon Aug 31 15:26:01 2020
New Revision: 364991
URL: https://svnweb.freebsd.org/changeset/base/364991

Log:
  opensm: Fix a possible dereference of a NULL pointer
  
  Reported by:	Coverity
  Reviewed by:	hselasky, kib
  MFC after:	2 weeks
  Sponsored by:	Dell EMC Isilon
  Differential Revision:	https://reviews.freebsd.org/D26233

Modified:
  head/contrib/ofed/opensm/opensm/osm_perfmgr.c

Modified: head/contrib/ofed/opensm/opensm/osm_perfmgr.c
==============================================================================
--- head/contrib/ofed/opensm/opensm/osm_perfmgr.c	Mon Aug 31 15:07:15 2020	(r364990)
+++ head/contrib/ofed/opensm/opensm/osm_perfmgr.c	Mon Aug 31 15:26:01 2020	(r364991)
@@ -1311,6 +1311,14 @@ static void perfmgr_check_overflow(osm_perfmgr_t * pm,
 		cl_plock_acquire(&pm->osm->lock);
 		p_node =
 		    osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+		if (!p_node) {
+			OSM_LOG(pm->log, OSM_LOG_ERROR,
+				"ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+				") no longer exists so removing from PerfMgr"
+                                " monitoring\n",
+				mon_node->name, mon_node->guid);
+			goto Exit;
+		}
 		lid = get_lid(p_node, port, mon_node);
 		cl_plock_release(&pm->osm->lock);
 		if (lid == 0) {
@@ -1402,6 +1410,14 @@ static void perfmgr_check_pce_overflow(osm_perfmgr_t *
 		cl_plock_acquire(&pm->osm->lock);
 		p_node =
 		    osm_get_node_by_guid(pm->subn, cl_hton64(mon_node->guid));
+		if (!p_node) {
+			OSM_LOG(pm->log, OSM_LOG_ERROR,
+				"ERR 5407: Node \"%s\" (guid 0x%" PRIx64
+				") no longer exists so removing from PerfMgr"
+                                " monitoring\n",
+				mon_node->name, mon_node->guid);
+			goto Exit;
+		}
 		lid = get_lid(p_node, port, mon_node);
 		cl_plock_release(&pm->osm->lock);
 		if (lid == 0) {


More information about the svn-src-head mailing list