Print this page
10543 dls_unbind() needs better checking
Reviewed by: Andy Fiddaman <andy@omniosce.org>
Reviewed by: Dan McDonald <danmcd@joyent.com>

@@ -23,11 +23,11 @@
  * Use is subject to license terms.
  * Copyright 2012, Nexenta Systems, Inc. All rights reserved.
  */
 
 /*
- * Copyright (c) 2013 Joyent, Inc.  All rights reserved.
+ * Copyright (c) 2019 Joyent, Inc.  All rights reserved.
  */
 
 /*
  * Data-Link Services Module
  */

@@ -216,17 +216,19 @@
 
         if (dsp->ds_nonip && --dsp->ds_dlp->dl_nonip_cnt == 0)
                 mac_rx_bypass_enable(dsp->ds_mch);
 
         /*
-         * For VLAN SAP, there was a promisc handle registered when dls_bind.
-         * When unbind this dls link, we need to remove the promisc handle.
-         * See comments in dls_bind().
+         * A VLAN SAP does not actually add itself to the STREAM head today.
+         * While we initially set up a VLAN handle below, it's possible that
+         * something else will have come in and clobberd it.
          */
+        if (dsp->ds_sap == ETHERTYPE_VLAN) {
         if (dsp->ds_vlan_mph != NULL) {
                 mac_promisc_remove(dsp->ds_vlan_mph);
                 dsp->ds_vlan_mph = NULL;
+                }
                 return;
         }
 
         /*
          * Unbind the dld_str_t by removing it from the hash table in the