diff options
Diffstat (limited to 'sys/kern/vfs_acl.c')
-rw-r--r-- | sys/kern/vfs_acl.c | 64 |
1 files changed, 20 insertions, 44 deletions
diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c index 2516d5c..6d04b04 100644 --- a/sys/kern/vfs_acl.c +++ b/sys/kern/vfs_acl.c @@ -327,16 +327,14 @@ int sys___acl_get_file(struct thread *td, struct __acl_get_file_args *uap) { struct nameidata nd; - int vfslocked, error; + int error; - NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); error = namei(&nd); - vfslocked = NDHASGIANT(&nd); if (error == 0) { error = vacl_get_acl(td, nd.ni_vp, uap->type, uap->aclp); NDFREE(&nd, 0); } - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -347,16 +345,14 @@ int sys___acl_get_link(struct thread *td, struct __acl_get_link_args *uap) { struct nameidata nd; - int vfslocked, error; + int error; - NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); error = namei(&nd); - vfslocked = NDHASGIANT(&nd); if (error == 0) { error = vacl_get_acl(td, nd.ni_vp, uap->type, uap->aclp); NDFREE(&nd, 0); } - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -367,16 +363,14 @@ int sys___acl_set_file(struct thread *td, struct __acl_set_file_args *uap) { struct nameidata nd; - int vfslocked, error; + int error; - NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); error = namei(&nd); - vfslocked = NDHASGIANT(&nd); if (error == 0) { error = vacl_set_acl(td, nd.ni_vp, uap->type, uap->aclp); NDFREE(&nd, 0); } - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -387,16 +381,14 @@ int sys___acl_set_link(struct thread *td, struct __acl_set_link_args *uap) { struct nameidata nd; - int vfslocked, error; + int error; - NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); error = namei(&nd); - vfslocked = NDHASGIANT(&nd); if (error == 0) { error = vacl_set_acl(td, nd.ni_vp, uap->type, uap->aclp); NDFREE(&nd, 0); } - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -407,14 +399,12 @@ int sys___acl_get_fd(struct thread *td, struct __acl_get_fd_args *uap) { struct file *fp; - int vfslocked, error; + int error; error = getvnode(td->td_proc->p_fd, uap->filedes, CAP_ACL_GET, &fp); if (error == 0) { - vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); error = vacl_get_acl(td, fp->f_vnode, uap->type, uap->aclp); fdrop(fp, td); - VFS_UNLOCK_GIANT(vfslocked); } return (error); } @@ -426,14 +416,12 @@ int sys___acl_set_fd(struct thread *td, struct __acl_set_fd_args *uap) { struct file *fp; - int vfslocked, error; + int error; error = getvnode(td->td_proc->p_fd, uap->filedes, CAP_ACL_SET, &fp); if (error == 0) { - vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); error = vacl_set_acl(td, fp->f_vnode, uap->type, uap->aclp); fdrop(fp, td); - VFS_UNLOCK_GIANT(vfslocked); } return (error); } @@ -445,16 +433,14 @@ int sys___acl_delete_file(struct thread *td, struct __acl_delete_file_args *uap) { struct nameidata nd; - int vfslocked, error; + int error; - NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); error = namei(&nd); - vfslocked = NDHASGIANT(&nd); if (error == 0) { error = vacl_delete(td, nd.ni_vp, uap->type); NDFREE(&nd, 0); } - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -465,16 +451,14 @@ int sys___acl_delete_link(struct thread *td, struct __acl_delete_link_args *uap) { struct nameidata nd; - int vfslocked, error; + int error; - NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); error = namei(&nd); - vfslocked = NDHASGIANT(&nd); if (error == 0) { error = vacl_delete(td, nd.ni_vp, uap->type); NDFREE(&nd, 0); } - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -485,15 +469,13 @@ int sys___acl_delete_fd(struct thread *td, struct __acl_delete_fd_args *uap) { struct file *fp; - int vfslocked, error; + int error; error = getvnode(td->td_proc->p_fd, uap->filedes, CAP_ACL_DELETE, &fp); if (error == 0) { - vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); error = vacl_delete(td, fp->f_vnode, uap->type); fdrop(fp, td); - VFS_UNLOCK_GIANT(vfslocked); } return (error); } @@ -505,16 +487,14 @@ int sys___acl_aclcheck_file(struct thread *td, struct __acl_aclcheck_file_args *uap) { struct nameidata nd; - int vfslocked, error; + int error; - NDINIT(&nd, LOOKUP, MPSAFE|FOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, uap->path, td); error = namei(&nd); - vfslocked = NDHASGIANT(&nd); if (error == 0) { error = vacl_aclcheck(td, nd.ni_vp, uap->type, uap->aclp); NDFREE(&nd, 0); } - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -525,16 +505,14 @@ int sys___acl_aclcheck_link(struct thread *td, struct __acl_aclcheck_link_args *uap) { struct nameidata nd; - int vfslocked, error; + int error; - NDINIT(&nd, LOOKUP, MPSAFE|NOFOLLOW, UIO_USERSPACE, uap->path, td); + NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, uap->path, td); error = namei(&nd); - vfslocked = NDHASGIANT(&nd); if (error == 0) { error = vacl_aclcheck(td, nd.ni_vp, uap->type, uap->aclp); NDFREE(&nd, 0); } - VFS_UNLOCK_GIANT(vfslocked); return (error); } @@ -545,15 +523,13 @@ int sys___acl_aclcheck_fd(struct thread *td, struct __acl_aclcheck_fd_args *uap) { struct file *fp; - int vfslocked, error; + int error; error = getvnode(td->td_proc->p_fd, uap->filedes, CAP_ACL_CHECK, &fp); if (error == 0) { - vfslocked = VFS_LOCK_GIANT(fp->f_vnode->v_mount); error = vacl_aclcheck(td, fp->f_vnode, uap->type, uap->aclp); fdrop(fp, td); - VFS_UNLOCK_GIANT(vfslocked); } return (error); } |