Print this page
5253 kmem_alloc/kmem_zalloc won't fail with KM_SLEEP
5254 getrbuf won't fail with KM_SLEEP


 326                 nfs4_dss_buflen = (long)nfs4_dss_bufsize;
 327                 error = 0;
 328                 break;
 329         }
 330 
 331         case NFS4_DSS_SETPATHS: {
 332                 char *nfs4_dss_bufp;
 333 
 334                 /* check that nfssrv module is loaded */
 335                 if (nfs_srv_dss_func == NULL)
 336                         return (set_errno(ENOTSUP));
 337 
 338                 /*
 339                  * NFS4_DSS_SETPATHS_SIZE must be called before
 340                  * NFS4_DSS_SETPATHS, to tell us how big a buffer we need
 341                  * to allocate.
 342                  */
 343                 if (nfs4_dss_buflen == 0)
 344                         return (set_errno(EINVAL));
 345                 nfs4_dss_bufp = kmem_alloc(nfs4_dss_buflen, KM_SLEEP);
 346                 if (nfs4_dss_bufp == NULL)
 347                         return (set_errno(ENOMEM));
 348 
 349                 if (copyin(arg, nfs4_dss_bufp, nfs4_dss_buflen)) {
 350                         kmem_free(nfs4_dss_bufp, nfs4_dss_buflen);
 351                         return (set_errno(EFAULT));
 352                 }
 353 
 354                 /* unpack the buffer and extract the pathnames */
 355                 error = nfs_srv_dss_func(nfs4_dss_bufp, nfs4_dss_buflen);
 356                 kmem_free(nfs4_dss_bufp, nfs4_dss_buflen);
 357 
 358                 break;
 359         }
 360 
 361         case NFS4_EPHEMERAL_MOUNT_TO: {
 362                 uint_t  mount_to;
 363 
 364                 /*
 365                  * Not a very complicated call.
 366                  */
 367                 if (copyin(arg, &mount_to, sizeof (mount_to)))




 326                 nfs4_dss_buflen = (long)nfs4_dss_bufsize;
 327                 error = 0;
 328                 break;
 329         }
 330 
 331         case NFS4_DSS_SETPATHS: {
 332                 char *nfs4_dss_bufp;
 333 
 334                 /* check that nfssrv module is loaded */
 335                 if (nfs_srv_dss_func == NULL)
 336                         return (set_errno(ENOTSUP));
 337 
 338                 /*
 339                  * NFS4_DSS_SETPATHS_SIZE must be called before
 340                  * NFS4_DSS_SETPATHS, to tell us how big a buffer we need
 341                  * to allocate.
 342                  */
 343                 if (nfs4_dss_buflen == 0)
 344                         return (set_errno(EINVAL));
 345                 nfs4_dss_bufp = kmem_alloc(nfs4_dss_buflen, KM_SLEEP);


 346 
 347                 if (copyin(arg, nfs4_dss_bufp, nfs4_dss_buflen)) {
 348                         kmem_free(nfs4_dss_bufp, nfs4_dss_buflen);
 349                         return (set_errno(EFAULT));
 350                 }
 351 
 352                 /* unpack the buffer and extract the pathnames */
 353                 error = nfs_srv_dss_func(nfs4_dss_bufp, nfs4_dss_buflen);
 354                 kmem_free(nfs4_dss_bufp, nfs4_dss_buflen);
 355 
 356                 break;
 357         }
 358 
 359         case NFS4_EPHEMERAL_MOUNT_TO: {
 360                 uint_t  mount_to;
 361 
 362                 /*
 363                  * Not a very complicated call.
 364                  */
 365                 if (copyin(arg, &mount_to, sizeof (mount_to)))