changeset 9700:30f7ca17cb40

6839058 configuring a MAC client with rings > 32 will panic the system
author Venugopal Iyer <Venu.Iyer@Sun.COM>
date Fri, 22 May 2009 09:09:06 -0700
parents fb90a02808bd
children cc5b64682e64
files usr/src/uts/common/io/mac/mac_datapath_setup.c usr/src/uts/common/sys/mac_provider.h
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/mac/mac_datapath_setup.c	Fri May 22 08:26:08 2009 -0700
+++ b/usr/src/uts/common/io/mac/mac_datapath_setup.c	Fri May 22 09:09:06 2009 -0700
@@ -1842,7 +1842,17 @@
 		/* First rx SRS, clear the bw structure */
 		if (flent->fe_rx_srs_cnt == 0)
 			bzero(mac_srs->srs_bw, sizeof (mac_bw_ctl_t));
-		ASSERT(flent->fe_rx_srs_cnt < MAX_RINGS_PER_GROUP);
+
+		/*
+		 * It is better to panic here rather than just assert because
+		 * on a non-debug kernel we might end up courrupting memory
+		 * and making it difficult to debug.
+		 */
+		if (flent->fe_rx_srs_cnt >= MAX_RINGS_PER_GROUP) {
+			panic("Array Overrun detected due to MAC client %p "
+			    " having more rings than %d", (void *)mcip,
+			    MAX_RINGS_PER_GROUP);
+		}
 		flent->fe_rx_srs[flent->fe_rx_srs_cnt] = mac_srs;
 		flent->fe_rx_srs_cnt++;
 	}
--- a/usr/src/uts/common/sys/mac_provider.h	Fri May 22 08:26:08 2009 -0700
+++ b/usr/src/uts/common/sys/mac_provider.h	Fri May 22 09:09:06 2009 -0700
@@ -259,7 +259,7 @@
 	MAC_RING_TYPE_TX	/* Transmit ring */
 } mac_ring_type_t;
 
-#define	MAX_RINGS_PER_GROUP	32
+#define	MAX_RINGS_PER_GROUP	128
 
 /*
  * Grouping type of a ring group