Print this page
OS-6357 proto_promiscoff_req() doesn't always exit the MAC perimeter

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/io/dld/dld_proto.c
          +++ new/usr/src/uts/common/io/dld/dld_proto.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright 2012, Nexenta Systems, Inc. All rights reserved.
       24 + * Copyright 2017 Joyent, Inc.
  24   25   */
  25   26  
  26   27  /*
  27   28   * Data-Link Driver
  28   29   */
  29   30  #include <sys/sysmacros.h>
  30   31  #include <sys/strsubr.h>
  31   32  #include <sys/strsun.h>
  32   33  #include <sys/vlan.h>
  33   34  #include <sys/dld_impl.h>
↓ open down ↓ 641 lines elided ↑ open up ↑
 675  676                  goto failed;
 676  677          }
 677  678  
 678  679          mac_perim_enter_by_mh(dsp->ds_mh, &mph);
 679  680  
 680  681          new_flags = dsp->ds_promisc;
 681  682          switch (dlp->dl_level) {
 682  683          case DL_PROMISC_SAP:
 683  684                  if (!(dsp->ds_promisc & DLS_PROMISC_SAP)) {
 684  685                          dl_err = DL_NOTENAB;
 685      -                        goto failed;
      686 +                        goto failed2;
 686  687                  }
 687  688                  new_flags &= ~DLS_PROMISC_SAP;
 688  689                  break;
 689  690  
 690  691          case DL_PROMISC_MULTI:
 691  692                  if (!(dsp->ds_promisc & DLS_PROMISC_MULTI)) {
 692  693                          dl_err = DL_NOTENAB;
 693      -                        goto failed;
      694 +                        goto failed2;
 694  695                  }
 695  696                  new_flags &= ~DLS_PROMISC_MULTI;
 696  697                  break;
 697  698  
 698  699          case DL_PROMISC_PHYS:
 699  700                  if (!(dsp->ds_promisc & DLS_PROMISC_PHYS)) {
 700  701                          dl_err = DL_NOTENAB;
 701      -                        goto failed;
      702 +                        goto failed2;
 702  703                  }
 703  704                  new_flags &= ~DLS_PROMISC_PHYS;
 704  705                  break;
 705  706  
 706  707          case DL_PROMISC_RX_ONLY:
 707  708                  if (!(dsp->ds_promisc & DLS_PROMISC_RX_ONLY)) {
 708  709                          dl_err = DL_NOTENAB;
 709      -                        goto failed;
      710 +                        goto failed2;
 710  711                  }
 711  712                  new_flags &= ~DLS_PROMISC_RX_ONLY;
 712  713                  break;
 713  714  
 714  715          case DL_PROMISC_FIXUPS:
 715  716                  if (!(dsp->ds_promisc & DLS_PROMISC_FIXUPS)) {
 716  717                          dl_err = DL_NOTENAB;
 717      -                        goto failed;
      718 +                        goto failed2;
 718  719                  }
 719  720                  new_flags &= ~DLS_PROMISC_FIXUPS;
 720  721                  break;
 721  722  
 722  723          default:
 723  724                  dl_err = DL_NOTSUPPORTED;
 724      -                mac_perim_exit(mph);
 725      -                goto failed;
      725 +                goto failed2;
 726  726          }
 727  727  
 728  728          /*
 729  729           * Adjust channel promiscuity.
 730  730           */
 731  731          err = dls_promisc(dsp, new_flags);
 732  732  
 733  733          if (err != 0) {
 734      -                mac_perim_exit(mph);
 735  734                  dl_err = DL_SYSERR;
 736      -                goto failed;
      735 +                goto failed2;
 737  736          }
 738  737  
 739  738          ASSERT(dsp->ds_promisc == new_flags);
 740  739          if (dsp->ds_promisc == 0)
 741  740                  dls_active_clear(dsp, B_FALSE);
 742  741  
 743  742          mac_perim_exit(mph);
 744  743  
 745  744          dlokack(q, mp, DL_PROMISCOFF_REQ);
 746  745          return;
      746 +failed2:
      747 +        mac_perim_exit(mph);
 747  748  failed:
 748  749          dlerrorack(q, mp, DL_PROMISCOFF_REQ, dl_err, (t_uscalar_t)err);
 749  750  }
 750  751  
 751  752  /*
 752  753   * DL_ENABMULTI_REQ
 753  754   */
 754  755  static void
 755  756  proto_enabmulti_req(dld_str_t *dsp, mblk_t *mp)
 756  757  {
↓ open down ↓ 1039 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX