From: Vladimir Koushnir <[email protected]>

Signed-off-by: Vladimir Koushnir <[email protected]>
Signed-off-by: Hal Rosenstock <[email protected]>
---
 opensm/osm_ucast_file.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/opensm/osm_ucast_file.c b/opensm/osm_ucast_file.c
index 2c2bf0c..a5408af 100644
--- a/opensm/osm_ucast_file.c
+++ b/opensm/osm_ucast_file.c
@@ -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");
-- 
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

Reply via email to