summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2015-11-18 06:57:24 +0000
committerderaadt <deraadt@openbsd.org>2015-11-18 06:57:24 +0000
commitfdfee3614a863af81f22378c1fede204be9dd213 (patch)
tree8a3d47976f66310130778c326d98564112216b51
parentrob pierce spotted a mistake left by jmc (diff)
downloadwireguard-openbsd-fdfee3614a863af81f22378c1fede204be9dd213.tar.xz
wireguard-openbsd-fdfee3614a863af81f22378c1fede204be9dd213.zip
In sys_revoke, inspect the VISTTY flag on the backside of VOP_GETATTR,
because that shows the /dev/console translated vnode. You either already know the story, or you don't want to know.
-rw-r--r--sys/kern/vfs_syscalls.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index e6f2519320d..f558bc6f001 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_syscalls.c,v 1.242 2015/11/16 18:29:35 deraadt Exp $ */
+/* $OpenBSD: vfs_syscalls.c,v 1.243 2015/11/18 06:57:24 deraadt Exp $ */
/* $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $ */
/*
@@ -2829,10 +2829,12 @@ sys_revoke(struct proc *p, void *v, register_t *retval)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
- if (!(vp->v_flag & VISTTY))
- return (ENOTTY);
if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0)
goto out;
+ if (!(vp->v_flag & VISTTY)) {
+ error = ENOTTY;
+ goto out;
+ }
if (p->p_ucred->cr_uid != vattr.va_uid &&
(error = suser(p, 0)))
goto out;