summaryrefslogtreecommitdiff
path: root/sys/kern/kern_event.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2018-04-03 09:10:03 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2018-04-03 09:10:03 +0000
commitc8774db306ebe967a20bebdb4a62f92c0d26e727 (patch)
tree08a97f895c10044cec9549ab9860d8cb905e22e2 /sys/kern/kern_event.c
parent12f1f8e74f40d9eabf360eecec44b0f10d49b20a (diff)
Move FREF()s just after fd_getfile() in sys_kevent(), sys_lseek() and
getvnode(). ok millert@
Diffstat (limited to 'sys/kern/kern_event.c')
-rw-r--r--sys/kern/kern_event.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/sys/kern/kern_event.c b/sys/kern/kern_event.c
index fb9cad360b1..b5d36212c22 100644
--- a/sys/kern/kern_event.c
+++ b/sys/kern/kern_event.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_event.c,v 1.84 2018/01/13 12:58:40 robert Exp $ */
+/* $OpenBSD: kern_event.c,v 1.85 2018/04/03 09:10:02 mpi Exp $ */
/*-
* Copyright (c) 1999,2000,2001 Jonathan Lemon <jlemon@FreeBSD.org>
@@ -479,12 +479,15 @@ sys_kevent(struct proc *p, void *v, register_t *retval)
int i, n, nerrors, error;
struct kevent kev[KQ_NEVENTS];
- if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL ||
- (fp->f_type != DTYPE_KQUEUE))
+ if ((fp = fd_getfile(fdp, SCARG(uap, fd))) == NULL)
return (EBADF);
-
FREF(fp);
+ if (fp->f_type != DTYPE_KQUEUE) {
+ error = EBADF;
+ goto done;
+ }
+
if (SCARG(uap, timeout) != NULL) {
error = copyin(SCARG(uap, timeout), &ts, sizeof(ts));
if (error)