changeset 13843:ecae50d1b4e7

2064 vnic sets up protection before upper mac leading to panic Reviewed by: Robert Mustacchi <rm@joyent.com> Reviewed by: Dan McDonald <danmcd@nexenta.com> Approved by: Garrett D'Amore <garrett@damore.org>
author Max Bruning <max@joyent.com>
date Mon, 01 Oct 2012 11:32:38 +0000
parents 0323baf2c0bb
children 90142813f484
files usr/src/uts/common/io/vnic/vnic_dev.c
diffstat 1 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/usr/src/uts/common/io/vnic/vnic_dev.c	Fri Sep 28 11:42:56 2012 +0000
+++ b/usr/src/uts/common/io/vnic/vnic_dev.c	Mon Oct 01 11:32:38 2012 +0000
@@ -405,15 +405,6 @@
 		if (err != 0)
 			goto bail;
 
-		if (mrp != NULL) {
-			if ((mrp->mrp_mask & MRP_RX_RINGS) != 0 ||
-			    (mrp->mrp_mask & MRP_TX_RINGS) != 0) {
-				req_hwgrp_flag = B_TRUE;
-			}
-			err = mac_client_set_resources(vnic->vn_mch, mrp);
-			if (err != 0)
-				goto bail;
-		}
 		/* assign a MAC address to the VNIC */
 
 		err = vnic_unicast_add(vnic, *vnic_addr_type, mac_slot,
@@ -517,9 +508,22 @@
 	}
 
 	/* Set the VNIC's MAC in the client */
-	if (!is_anchor)
+	if (!is_anchor) {
 		mac_set_upper_mac(vnic->vn_mch, vnic->vn_mh, mrp);
 
+		if (mrp != NULL) {
+			if ((mrp->mrp_mask & MRP_RX_RINGS) != 0 ||
+			    (mrp->mrp_mask & MRP_TX_RINGS) != 0) {
+				req_hwgrp_flag = B_TRUE;
+			}
+			err = mac_client_set_resources(vnic->vn_mch, mrp);
+			if (err != 0) {
+				(void) mac_unregister(vnic->vn_mh);
+				goto bail;
+			}
+		}
+	}
+
 	err = dls_devnet_create(vnic->vn_mh, vnic->vn_id, crgetzoneid(credp));
 	if (err != 0) {
 		VERIFY(is_anchor || mac_margin_remove(vnic->vn_lower_mh,