Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 31 Aug 2020 15:26:02 +0000 (UTC)
From:      Eric van Gyzen <vangyzen@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364991 - head/contrib/ofed/opensm/opensm
Message-ID:  <202008311526.07VFQ2Bo010173@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008311526.07VFQ2Bo010173>