Print this page
13026 SMB and NFS use the global zone's IDMAP when they shouldn't
Change-Id: I3b5f7bc68bb77764aa7cb59a48dd1740a8387ccf
        
@@ -22,10 +22,14 @@
 /*
  * 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,11 +103,10 @@
  * 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()
 {
@@ -114,11 +117,10 @@
 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);
 }
@@ -209,12 +211,10 @@
 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)
 {
@@ -224,11 +224,11 @@
             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,
+                    OPEN_FLAGS, kcred, &handle_impl->devhandle,
                     ldi_identifier);
         }
 
         if (rval != SUCCESS) {
                 kmem_free(handle_impl, sizeof (fire_counter_handle_impl_t));
@@ -241,11 +241,11 @@
 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);
+        (void) ldi_close(handle_impl->devhandle, OPEN_FLAGS, kcred);
         kmem_free(handle_impl, sizeof (fire_counter_handle_impl_t));
         return (SUCCESS);
 }
 
 int
@@ -279,11 +279,11 @@
         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)) {
+            FKIOCTL, kcred, &ioctl_rval)) == SUCCESS) && (!is_write)) {
                 *reg_data = prg.data;
         }
 
         return (rval);
 }
@@ -320,11 +320,11 @@
 
         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)) {
+            FKIOCTL, kcred, &ioctl_rval)) == SUCCESS) && (!is_write)) {
                 *value = prg.data;
         }
 
         return (rval);
 }