Print this page
13026 SMB and NFS use the global zone's IDMAP when they shouldn't
Change-Id: I3b5f7bc68bb77764aa7cb59a48dd1740a8387ccf
        
*** 22,31 ****
--- 22,35 ----
  /*
   * Copyright 2007 Sun Microsystems, Inc.  All rights reserved.
   * Use is subject to license terms.
   */
  
+ /*
+  * Copyright 2020 Nexenta by DDN, Inc. All rights reserved.
+  */
+ 
  #include <sys/file.h>
  #include <sys/sunndi.h>
  #include <sys/sunddi.h>
  #include <sys/sunldi.h>
  #include <io/px/px_regs.h>
*** 99,109 ****
   * module, and as long as it remains untouched by other modules we're OK.
   */
  
  static ldi_ident_t ldi_identifier;
  static boolean_t ldi_identifier_valid = B_FALSE;
- static cred_t *credentials = NULL;
  
  /* Called by _init to determine if it is OK to install driver. */
  int
  fpc_platform_check()
  {
--- 103,112 ----
*** 114,124 ****
  int
  fpc_platform_module_init(dev_info_t *dip)
  {
          int status;
  
-         credentials = crget();
          status = ldi_ident_from_dip(dip, &ldi_identifier);
          if (status == 0)
                  ldi_identifier_valid = B_TRUE;
          return ((status == 0) ? DDI_SUCCESS : DDI_FAILURE);
  }
--- 117,126 ----
*** 209,220 ****
  void
  fpc_platform_module_fini(dev_info_t *dip)
  {
          if (ldi_identifier_valid)
                  ldi_ident_release(ldi_identifier);
-         if (credentials)
-                 crfree(credentials);
  }
  
  fire_perfreg_handle_t
  fpc_get_perfreg_handle(int devnum)
  {
--- 211,220 ----
*** 224,234 ****
              kmem_zalloc(sizeof (fire_counter_handle_impl_t), KM_SLEEP);
  
          if ((handle_impl->devspec =
              fpc_get_platform_data_by_number(devnum)) != NULL) {
                  rval = ldi_open_by_name(handle_impl->devspec->nodename,
!                     OPEN_FLAGS, credentials, &handle_impl->devhandle,
                      ldi_identifier);
          }
  
          if (rval != SUCCESS) {
                  kmem_free(handle_impl, sizeof (fire_counter_handle_impl_t));
--- 224,234 ----
              kmem_zalloc(sizeof (fire_counter_handle_impl_t), KM_SLEEP);
  
          if ((handle_impl->devspec =
              fpc_get_platform_data_by_number(devnum)) != NULL) {
                  rval = ldi_open_by_name(handle_impl->devspec->nodename,
!                     OPEN_FLAGS, kcred, &handle_impl->devhandle,
                      ldi_identifier);
          }
  
          if (rval != SUCCESS) {
                  kmem_free(handle_impl, sizeof (fire_counter_handle_impl_t));
*** 241,251 ****
  int
  fpc_free_counter_handle(fire_perfreg_handle_t handle)
  {
          fire_counter_handle_impl_t *handle_impl =
              (fire_counter_handle_impl_t *)handle;
!         (void) ldi_close(handle_impl->devhandle, OPEN_FLAGS, credentials);
          kmem_free(handle_impl, sizeof (fire_counter_handle_impl_t));
          return (SUCCESS);
  }
  
  int
--- 241,251 ----
  int
  fpc_free_counter_handle(fire_perfreg_handle_t handle)
  {
          fire_counter_handle_impl_t *handle_impl =
              (fire_counter_handle_impl_t *)handle;
!         (void) ldi_close(handle_impl->devhandle, OPEN_FLAGS, kcred);
          kmem_free(handle_impl, sizeof (fire_counter_handle_impl_t));
          return (SUCCESS);
  }
  
  int
*** 279,289 ****
          prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_8 | PCITOOL_ACC_ATTR_ENDN_BIG;
          prg.data = *reg_data;
  
          /* Read original value. */
          if (((rval = ldi_ioctl(handle_impl->devhandle, cmd, (intptr_t)&prg,
!             FKIOCTL, credentials, &ioctl_rval)) == SUCCESS) && (!is_write)) {
                  *reg_data = prg.data;
          }
  
          return (rval);
  }
--- 279,289 ----
          prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_8 | PCITOOL_ACC_ATTR_ENDN_BIG;
          prg.data = *reg_data;
  
          /* Read original value. */
          if (((rval = ldi_ioctl(handle_impl->devhandle, cmd, (intptr_t)&prg,
!             FKIOCTL, kcred, &ioctl_rval)) == SUCCESS) && (!is_write)) {
                  *reg_data = prg.data;
          }
  
          return (rval);
  }
*** 320,330 ****
  
          prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_8 | PCITOOL_ACC_ATTR_ENDN_BIG;
          prg.data = *value;
  
          if (((rval = ldi_ioctl(handle_impl->devhandle, command, (intptr_t)&prg,
!             FKIOCTL, credentials, &ioctl_rval)) == SUCCESS) && (!is_write)) {
                  *value = prg.data;
          }
  
          return (rval);
  }
--- 320,330 ----
  
          prg.acc_attr = PCITOOL_ACC_ATTR_SIZE_8 | PCITOOL_ACC_ATTR_ENDN_BIG;
          prg.data = *value;
  
          if (((rval = ldi_ioctl(handle_impl->devhandle, command, (intptr_t)&prg,
!             FKIOCTL, kcred, &ioctl_rval)) == SUCCESS) && (!is_write)) {
                  *value = prg.data;
          }
  
          return (rval);
  }