summaryrefslogtreecommitdiffstats
path: root/sys/kern/vfs_acl.c
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-01-24 00:35:12 +0000
committerjhb <jhb@FreeBSD.org>2001-01-24 00:35:12 +0000
commit7c01c0a2c2233d1a835a785e4f8862fc3647c8be (patch)
treedb7b45f100c917594593eb54a24f456f32551e3d /sys/kern/vfs_acl.c
parent1046fa2a8d8317274a39242a50a349689437a5a7 (diff)
downloadFreeBSD-src-7c01c0a2c2233d1a835a785e4f8862fc3647c8be.zip
FreeBSD-src-7c01c0a2c2233d1a835a785e4f8862fc3647c8be.tar.gz
Proc locking.
Diffstat (limited to 'sys/kern/vfs_acl.c')
-rw-r--r--sys/kern/vfs_acl.c40
1 files changed, 32 insertions, 8 deletions
diff --git a/sys/kern/vfs_acl.c b/sys/kern/vfs_acl.c
index 0e9fc40..8d0c6c7 100644
--- a/sys/kern/vfs_acl.c
+++ b/sys/kern/vfs_acl.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);
}
OpenPOWER on IntegriCloud