linux-rdma.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 7/8] opensm/osm_port_info_rcv.c: check received local_port_num
@ 2012-08-14 21:41 Yevgeny Kliteynik
  0 siblings, 0 replies; only message in thread
From: Yevgeny Kliteynik @ 2012-08-14 21:41 UTC (permalink / raw)
  To: Linux RDMA, alexne-VPRAkNaXOzVWk0Htik3J/w, Yevgeny Kliteynik


Signed-off-by: Yevgeny Kliteynik <kliteyn-LDSdmyG8hGV8YrgS2mwiifqBs+8SCbDb@public.gmane.org>
---
 opensm/osm_port_info_rcv.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/opensm/osm_port_info_rcv.c b/opensm/osm_port_info_rcv.c
index c3bc66c..442bc3f 100644
--- a/opensm/osm_port_info_rcv.c
+++ b/opensm/osm_port_info_rcv.c
@@ -505,6 +505,11 @@ void osm_pi_rcv_process(IN void *context, IN void *data)

 	CL_ASSERT(p_smp->attr_id == IB_MAD_ATTR_PORT_INFO);

+	/*
+	 * Attribute modifier has already been validated upon MAD receive,
+	 * which means that port_num has to be valid - it originated from
+	 * the request attribute modifier.
+	 */
 	port_num = (uint8_t) cl_ntoh32(p_smp->attr_mod);

 	port_guid = p_context->port_guid;
@@ -554,6 +559,17 @@ 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 0F15: "
+			"Received PortInfo for port GUID 0x%" PRIx64 " is "
+			"non-compliant and is being ignored since the "
+			"local port num %u > num ports %u\n",
+			cl_ntoh64(port_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.11.1

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

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2012-08-14 21:41 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-08-14 21:41 [PATCH 7/8] opensm/osm_port_info_rcv.c: check received local_port_num Yevgeny Kliteynik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).