Skip to contentSkip to conversation

osm_ucast_file.c: Fix crash when port is invalid in LFT file

PATCH New Hal Rosenstock 1 participant 1 message Dec 26, 2013 InfiniBand

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 osm_ucast_file.c: Fix crash when port is invalid in LFT file

From: Vladimir Koushnir <vladimirk-VPRAkNaXOzVWk0Htik3J/[email protected]>

---
 opensm/osm_ucast_file.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
opensm/osm_ucast_file.c +11 -0
index 2c2bf0c..a5408af 100644
@@ -216,6 +216,17 @@ static int do_ucast_file_load(void *context)
 					file_name, lineno, p);
 				goto Exit;
 			}
+			if (port_num >=
+				osm_node_get_num_physp(p_sw->p_node)) {
+					OSM_LOG(&p_osm->log, OSM_LOG_ERROR,
+						"Invalid port %d found "
+						"for switch %016" PRIx64 "\n",
+						port_num,
+						cl_ntoh64(osm_node_get_node_guid
+							(p_sw->p_node)));
+					goto Exit;
+			}
+
 			p = q;
 			/* additionally try to extract guid */
 			q = strstr(p, " portguid 0x");
Signature · 6 lines
1.7.8.2

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html