summaryrefslogtreecommitdiff
path: root/sys/kern
diff options
context:
space:
mode:
authorGerhard Roth <gerhard@cvs.openbsd.org>2017-06-20 14:11:47 +0000
committerGerhard Roth <gerhard@cvs.openbsd.org>2017-06-20 14:11:47 +0000
commit9424e5e75a1f54e46a4da7e7d31dabe86ccce16d (patch)
treeb93fddc1af2868472267947b86f7f5c0e31add6e /sys/kern
parent6939bfb23307b049666dc01561473797bc621408 (diff)
Do not touch file pointers for which FILE_IS_USABLE() is false.
They're might not be fully constructed. ok mpi@ deraadt@ bluhm@
Diffstat (limited to 'sys/kern')
-rw-r--r--sys/kern/kern_sysctl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sys/kern/kern_sysctl.c b/sys/kern/kern_sysctl.c
index 16d1d279036..7b71ccfde26 100644
--- a/sys/kern/kern_sysctl.c
+++ b/sys/kern/kern_sysctl.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_sysctl.c,v 1.328 2017/06/14 03:00:40 dlg Exp $ */
+/* $OpenBSD: kern_sysctl.c,v 1.329 2017/06/20 14:11:46 gerhard Exp $ */
/* $NetBSD: kern_sysctl.c,v 1.17 1996/05/20 17:49:05 mrg Exp $ */
/*-
@@ -1327,6 +1327,7 @@ sysctl_file(int *name, u_int namelen, char *where, size_t *sizep,
FREF(fp);
do {
if (fp->f_count > 1 && /* 0, +1 for our FREF() */
+ FILE_IS_USABLE(fp) &&
(arg == 0 || fp->f_type == arg)) {
int af, skip = 0;
if (arg == DTYPE_SOCKET && fp->f_type == arg) {