diff options
| author | John Baldwin <jhb@FreeBSD.org> | 2001-01-24 00:35:12 +0000 |
|---|---|---|
| committer | John Baldwin <jhb@FreeBSD.org> | 2001-01-24 00:35:12 +0000 |
| commit | e5690aadaa4022bff9b38e68d3eded7918e11c26 (patch) | |
| tree | 466620d63ed8c9cc2e5240d55a93d9dae3fdbb23 /sys/kern/subr_acl_posix1e.c | |
| parent | a914fb6b27c9e4bca79cf2c4b7f568777347e0d3 (diff) | |
Notes
Diffstat (limited to 'sys/kern/subr_acl_posix1e.c')
| -rw-r--r-- | sys/kern/subr_acl_posix1e.c | 40 |
1 files changed, 32 insertions, 8 deletions
diff --git a/sys/kern/subr_acl_posix1e.c b/sys/kern/subr_acl_posix1e.c index 0e9fc40acaa2..8d0c6c733fba 100644 --- a/sys/kern/subr_acl_posix1e.c +++ b/sys/kern/subr_acl_posix1e.c @@ -72,16 +72,22 @@ vacl_set_acl(struct proc *p, struct vnode *vp, acl_type_t type, struct acl *aclp) { struct acl inkernacl; + struct ucred *uc; int error; error = copyin(aclp, &inkernacl, sizeof(struct acl)); if (error) return(error); - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); + PROC_LOCK(p); + uc = p->p_ucred; + crhold(uc); + PROC_UNLOCK(p); + VOP_LEASE(vp, p, uc, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_SETACL(vp, type, &inkernacl, p->p_ucred, p); + error = VOP_SETACL(vp, type, &inkernacl, uc, p); VOP_UNLOCK(vp, 0, p); - return(error); + crfree(uc); + return (error); } /* @@ -92,12 +98,18 @@ vacl_get_acl(struct proc *p, struct vnode *vp, acl_type_t type, struct acl *aclp) { struct acl inkernelacl; + struct ucred *uc; int error; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); + PROC_LOCK(p); + uc = p->p_ucred; + crhold(uc); + PROC_UNLOCK(p); + VOP_LEASE(vp, p, uc, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_GETACL(vp, type, &inkernelacl, p->p_ucred, p); + error = VOP_GETACL(vp, type, &inkernelacl, uc, p); VOP_UNLOCK(vp, 0, p); + crfree(uc); if (error == 0) error = copyout(&inkernelacl, aclp, sizeof(struct acl)); return (error); @@ -109,12 +121,18 @@ vacl_get_acl(struct proc *p, struct vnode *vp, acl_type_t type, static int vacl_delete(struct proc *p, struct vnode *vp, acl_type_t type) { + struct ucred *uc; int error; - VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); + PROC_LOCK(p); + uc = p->p_ucred; + crhold(uc); + PROC_UNLOCK(p); + VOP_LEASE(vp, p, uc, LEASE_WRITE); vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p); - error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, p->p_ucred, p); + error = VOP_SETACL(vp, ACL_TYPE_DEFAULT, 0, uc, p); VOP_UNLOCK(vp, 0, p); + crfree(uc); return (error); } @@ -126,12 +144,18 @@ vacl_aclcheck(struct proc *p, struct vnode *vp, acl_type_t type, struct acl *aclp) { struct acl inkernelacl; + struct ucred *uc; int error; error = copyin(aclp, &inkernelacl, sizeof(struct acl)); if (error) return(error); - error = VOP_ACLCHECK(vp, type, &inkernelacl, p->p_ucred, p); + PROC_LOCK(p); + uc = p->p_ucred; + crhold(uc); + PROC_UNLOCK(p); + error = VOP_ACLCHECK(vp, type, &inkernelacl, uc, p); + crfree(uc); return (error); } |
