summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2002-02-10 20:45:43 +0000
committerRobert Watson <rwatson@FreeBSD.org>2002-02-10 20:45:43 +0000
commitc0a9dc83c8300849aec74c7a1a339b9bf25db14b (patch)
tree5b6b1d695b751eee3daa500e4f53355dcc13dbf7
parent535cc97895309bd73b24c9fac85c42ab16c9687c (diff)
Notes
-rw-r--r--sys/kern/vfs_extattr.c14
-rw-r--r--sys/kern/vfs_syscalls.c14
2 files changed, 18 insertions, 10 deletions
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 380bdc593b8f..9b623e351266 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -3525,18 +3525,22 @@ revoke(td, uap)
int error;
struct nameidata nd;
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td);
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, SCARG(uap, path),
+ td);
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
NDFREE(&nd, NDF_ONLY_PNBUF);
if (vp->v_type != VCHR) {
- error = EINVAL;
- goto out;
+ vput(vp);
+ return (EINVAL);
}
error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td);
- if (error)
- goto out;
+ if (error) {
+ vput(vp);
+ return (error);
+ }
+ VOP_UNLOCK(vp, 0, td);
if (td->td_proc->p_ucred->cr_uid != vattr.va_uid) {
error = suser_xxx(0, td->td_proc, PRISON_ROOT);
if (error)
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 380bdc593b8f..9b623e351266 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -3525,18 +3525,22 @@ revoke(td, uap)
int error;
struct nameidata nd;
- NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), td);
+ NDINIT(&nd, LOOKUP, FOLLOW | LOCKLEAF, UIO_USERSPACE, SCARG(uap, path),
+ td);
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
NDFREE(&nd, NDF_ONLY_PNBUF);
if (vp->v_type != VCHR) {
- error = EINVAL;
- goto out;
+ vput(vp);
+ return (EINVAL);
}
error = VOP_GETATTR(vp, &vattr, td->td_proc->p_ucred, td);
- if (error)
- goto out;
+ if (error) {
+ vput(vp);
+ return (error);
+ }
+ VOP_UNLOCK(vp, 0, td);
if (td->td_proc->p_ucred->cr_uid != vattr.va_uid) {
error = suser_xxx(0, td->td_proc, PRISON_ROOT);
if (error)