sys_revoke: call vrele() before returning ENOTTY
authorsemarie <semarie@openbsd.org>
Mon, 27 Jun 2016 04:14:38 +0000 (04:14 +0000)
committersemarie <semarie@openbsd.org>
Mon, 27 Jun 2016 04:14:38 +0000 (04:14 +0000)
ok guenther@

sys/kern/vfs_syscalls.c

index ffaaefa..dd43f16 100644 (file)
@@ -1,4 +1,4 @@
-/*     $OpenBSD: vfs_syscalls.c,v 1.257 2016/06/26 14:27:14 semarie Exp $      */
+/*     $OpenBSD: vfs_syscalls.c,v 1.258 2016/06/27 04:14:38 semarie Exp $      */
 /*     $NetBSD: vfs_syscalls.c,v 1.71 1996/04/23 10:29:02 mycroft Exp $        */
 
 /*
@@ -2796,8 +2796,10 @@ sys_revoke(struct proc *p, void *v, register_t *retval)
                return (error);
        vp = nd.ni_vp;
        if (vp->v_type != VCHR || (u_int)major(vp->v_rdev) >= nchrdev ||
-           cdevsw[major(vp->v_rdev)].d_type != D_TTY)
-               return (ENOTTY);
+           cdevsw[major(vp->v_rdev)].d_type != D_TTY) {
+               error = ENOTTY;
+               goto out;
+       }
        if ((error = VOP_GETATTR(vp, &vattr, p->p_ucred, p)) != 0)
                goto out;
        if (p->p_ucred->cr_uid != vattr.va_uid &&