Print this page
Caution with use after exi_rele()
Be far more judicious in the use of curzone-using macros.
(Merge and extra asserts by danmcd.)

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/nfs/nfs_server.c
          +++ new/usr/src/uts/common/fs/nfs/nfs_server.c
↓ open down ↓ 2939 lines elided ↑ open up ↑
2940 2940  
2941 2941                          /*
2942 2942                           * Found a valid vp for index "filename". Sanity check
2943 2943                           * for odd case where a directory is provided as index
2944 2944                           * option argument and leads us to another filesystem
2945 2945                           */
2946 2946  
2947 2947                          /* Release the reference on the old exi value */
2948 2948                          ASSERT(*exi != NULL);
2949 2949                          exi_rele(*exi);
     2950 +                        *exi = NULL;
2950 2951  
2951 2952                          if (error = nfs_check_vpexi(mc_dvp, *vpp, kcred, exi)) {
2952 2953                                  VN_RELE(*vpp);
2953 2954                                  goto publicfh_done;
2954 2955                          }
     2956 +                        /* Have a new *exi */
2955 2957                  }
2956 2958          }
2957 2959  
2958 2960  publicfh_done:
2959 2961          if (mc_dvp)
2960 2962                  VN_RELE(mc_dvp);
2961 2963  
2962 2964          return (error);
2963 2965  }
2964 2966  
↓ open down ↓ 6 lines elided ↑ open up ↑
2971 2973          vnode_t **dirvpp,               /* ret for ptr to parent dir vnode */
2972 2974          vnode_t **compvpp,              /* ret for ptr to component vnode */
2973 2975          vnode_t *startdvp,              /* starting vnode */
2974 2976          cred_t *cr,                     /* user's credential */
2975 2977          int pathflag)                   /* flag to identify path, e.g. URL */
2976 2978  {
2977 2979          char namebuf[TYPICALMAXPATHLEN];
2978 2980          struct pathname pn;
2979 2981          int error;
2980 2982  
     2983 +        ASSERT3U(crgetzoneid(cr), ==, curzone->zone_id);
     2984 +
2981 2985          /*
2982 2986           * If pathname starts with '/', then set startdvp to root.
2983 2987           */
2984 2988          if (*path == '/') {
2985 2989                  while (*path == '/')
2986 2990                          path++;
2987 2991  
2988 2992                  startdvp = ZONE_ROOTVP();
2989 2993          }
2990 2994  
↓ open down ↓ 411 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX