summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_tame.c
diff options
context:
space:
mode:
authornicm <nicm@openbsd.org>2015-07-20 17:01:26 +0000
committernicm <nicm@openbsd.org>2015-07-20 17:01:26 +0000
commit24fac29bb8db65134f45278209c33e785e2a9178 (patch)
tree9be4d0621f39f4cfa13dcbfa6648fa118f91d494 /sys/kern/kern_tame.c
parentRemove condition that never happens and fix error handling. (diff)
downloadwireguard-openbsd-24fac29bb8db65134f45278209c33e785e2a9178.tar.xz
wireguard-openbsd-24fac29bb8db65134f45278209c33e785e2a9178.zip
Be more paranoid and don't let any ioctls through with invalid file
descriptors.
Diffstat (limited to 'sys/kern/kern_tame.c')
-rw-r--r--sys/kern/kern_tame.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/sys/kern/kern_tame.c b/sys/kern/kern_tame.c
index f590ce07d5b..b366d84a8ac 100644
--- a/sys/kern/kern_tame.c
+++ b/sys/kern/kern_tame.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_tame.c,v 1.7 2015/07/20 16:48:07 nicm Exp $ */
+/* $OpenBSD: kern_tame.c,v 1.8 2015/07/20 17:01:26 nicm Exp $ */
/*
* Copyright (c) 2015 Nicholas Marriott <nicm@openbsd.org>
@@ -684,8 +684,9 @@ tame_ioctl_check(struct proc *p, long com, void *v)
if ((p->p_p->ps_flags & PS_TAMED) == 0)
return (0);
- if (fp != NULL)
- vp = (struct vnode *)fp->f_data;
+ if (fp == NULL)
+ return (EBADF);
+ vp = (struct vnode *)fp->f_data;
switch (com) {