[PATCH] opensm/osm_port_info_rcv.c: Handle non-compliant SMA gracefully

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


If PortInfo.LocalPortNum > NodeInfo.NumPorts, then SMA is
not compliant. In this case, ignore the portinfo response.

Signed-off-by: Hal Rosenstock <hal@xxxxxxxxxxxx>
---
 opensm/osm_port_info_rcv.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/opensm/osm_port_info_rcv.c b/opensm/osm_port_info_rcv.c
index a4f81a8..d243bb2 100644
--- a/opensm/osm_port_info_rcv.c
+++ b/opensm/osm_port_info_rcv.c
@@ -552,6 +552,18 @@ void osm_pi_rcv_process(IN void *context, IN void *data)
 	p_node = p_port->p_node;
 	CL_ASSERT(p_node);
 
+	if (p_pi->local_port_num > p_node->node_info.num_ports) {
+		CL_PLOCK_RELEASE(sm->p_lock);
+		OSM_LOG(sm->p_log, OSM_LOG_ERROR, "ERR 0F09: "
+			"PortInfo from %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_node->node_info.node_type),
+			cl_ntoh64(p_node->node_info.node_guid),
+			p_pi->local_port_num, p_node->node_info.num_ports);
+		goto Exit;
+	}
+
 	/*
 	   If we were setting the PortInfo, then receiving
 	   this attribute was not part of sweeping the subnet.
-- 
1.7.8.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