[PATCH 24/27] opensm/osm_node_info_rcv.c: Handle non-compliant SMA gracefully

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Hal Rosenstock <hal@xxxxxxxxxxxx>

If NodeInfo.LocalPortNum > NodeInfo.NumPorts, then SMA is
not compliant. In this case, ignore the node and don't add
it to any subnet data structures.

Signed-off-by: Hal Rosenstock <hal@xxxxxxxxxxxx>
Signed-off-by: Alex Netes <alexne@xxxxxxxxxxxx>
---
 opensm/osm_node_info_rcv.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/opensm/osm_node_info_rcv.c b/opensm/osm_node_info_rcv.c
index c35aea4..75ab853 100644
--- a/opensm/osm_node_info_rcv.c
+++ b/opensm/osm_node_info_rcv.c
@@ -624,6 +624,17 @@ static void ni_rcv_process_new(IN osm_sm_t * sm, IN const osm_madw_t * p_madw)
 		ib_get_node_type_str(p_ni->node_type),
 		cl_ntoh64(p_ni->node_guid), cl_ntoh64(p_smp->trans_id));
 
+	if (port_num > p_ni->num_ports) {
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D0A: "
+			"New %s node GUID 0x%" PRIx64 "is non-compliant and "
+			"is being ignored since the "
+			"local port num %u > num ports %u\n",
+			ib_get_node_type_str(p_ni->node_type),
+			cl_ntoh64(p_ni->node_guid), port_num,
+			p_ni->num_ports);
+		goto Exit;
+	}
+
 	p_node = osm_node_new(p_madw);
 	if (p_node == NULL) {
 		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0D07: "
-- 
1.7.11.2

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


[Home]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]    [Yosemite Photos]    [Free Online Dating]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Devices]

Add to Google Powered by Linux