summaryrefslogtreecommitdiffstats
path: root/sys/compat/svr4
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2001-01-27 00:01:31 +0000
committerjhb <jhb@FreeBSD.org>2001-01-27 00:01:31 +0000
commitb6baa60b1e807d09641c20b2ff1fe838ddebbd3b (patch)
tree81781cbbf3ad98f73e64d11188dfe3084b844e12 /sys/compat/svr4
parent0c5b7b7672ac24978496b6d8b72a9f4c74349b64 (diff)
downloadFreeBSD-src-b6baa60b1e807d09641c20b2ff1fe838ddebbd3b.zip
FreeBSD-src-b6baa60b1e807d09641c20b2ff1fe838ddebbd3b.tar.gz
Back out proc locking to protect p_ucred for obtaining additional
references along with the actual obtaining of additional references.
Diffstat (limited to 'sys/compat/svr4')
-rw-r--r--sys/compat/svr4/svr4_fcntl.c24
-rw-r--r--sys/compat/svr4/svr4_misc.c18
2 files changed, 6 insertions, 36 deletions
diff --git a/sys/compat/svr4/svr4_fcntl.c b/sys/compat/svr4/svr4_fcntl.c
index 3b8adad..c2b865a 100644
--- a/sys/compat/svr4/svr4_fcntl.c
+++ b/sys/compat/svr4/svr4_fcntl.c
@@ -249,7 +249,6 @@ fd_revoke(p, fd)
struct vnode *vp;
struct mount *mp;
struct vattr vattr;
- struct ucred *uc;
int error, *retval;
retval = p->p_retval;
@@ -266,20 +265,12 @@ fd_revoke(p, fd)
goto out;
}
- PROC_LOCK(p);
- uc = p->p_ucred;
- crhold(uc);
- PROC_UNLOCK(p);
- if ((error = VOP_GETATTR(vp, &vattr, uc, p)) != 0) {
- crfree(uc);
+ if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0)
goto out;
- }
- if (uc->cr_uid != vattr.va_uid && (error = suser(p)) != 0) {
- crfree(uc);
+ if (p->p_ucred->cr_uid != vattr.va_uid &&
+ (error = suser(p)) != 0)
goto out;
- }
- crfree(uc);
if ((error = vn_start_write(vp, &mp, V_WAIT | PCATCH)) != 0)
goto out;
@@ -303,7 +294,6 @@ fd_truncate(p, fd, flp)
off_t start, length;
struct vnode *vp;
struct vattr vattr;
- struct ucred *uc;
int error, *retval;
struct ftruncate_args ft;
@@ -319,13 +309,7 @@ fd_truncate(p, fd, flp)
if (fp->f_type != DTYPE_VNODE || vp->v_type == VFIFO)
return ESPIPE;
- PROC_LOCK(p);
- uc = p->p_ucred;
- crhold(uc);
- PROC_UNLOCK(p);
- error = VOP_GETATTR(vp, &vattr, uc, p);
- crfree(uc);
- if (error != 0)
+ if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0)
return error;
length = vattr.va_size;
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 62d0da9..b976c2d 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -250,7 +250,6 @@ svr4_sys_getdents64(p, uap)
struct uio auio;
struct iovec aiov;
struct vattr va;
- struct ucred *uc;
off_t off;
struct svr4_dirent64 svr4_dirent;
int buflen, error, eofflag, nbytes, justone;
@@ -271,13 +270,7 @@ svr4_sys_getdents64(p, uap)
if (vp->v_type != VDIR)
return (EINVAL);
- PROC_LOCK(p);
- uc = p->p_ucred;
- crhold(uc);
- PROC_UNLOCK(p);
- error = VOP_GETATTR(vp, &va, uc, p);
- crfree(uc);
- if (error != 0) {
+ if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) {
return error;
}
@@ -599,7 +592,6 @@ svr4_sys_fchroot(p, uap)
struct filedesc *fdp = p->p_fd;
struct vnode *vp;
struct file *fp;
- struct ucred *uc;
int error;
if ((error = suser(p)) != 0)
@@ -610,14 +602,8 @@ svr4_sys_fchroot(p, uap)
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
if (vp->v_type != VDIR)
error = ENOTDIR;
- else {
- PROC_LOCK(p);
- uc = p->p_ucred;
- crhold(uc);
- PROC_UNLOCK(p);
+ else
error = VOP_ACCESS(vp, VEXEC, p->p_ucred, p);
- crfree(uc);
- }
VOP_UNLOCK(vp, 0, p);
if (error)
return error;
OpenPOWER on IntegriCloud