summaryrefslogtreecommitdiffstats
path: root/sys/kern/sys_pipe.c
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2018-08-15 13:19:06 +0000
committervisa <visa@openbsd.org>2018-08-15 13:19:06 +0000
commitfcba5756a8a8a1d0fcfc7739b7b416fefb81f00f (patch)
treebb4625b97f9bc8ec39e3fbe82c7ad4142b1e100e /sys/kern/sys_pipe.c
parentFix struct soplice usage (diff)
downloadwireguard-openbsd-fcba5756a8a8a1d0fcfc7739b7b416fefb81f00f.tar.xz
wireguard-openbsd-fcba5756a8a8a1d0fcfc7739b7b416fefb81f00f.zip
Grab the KERNEL_LOCK() in MP-unsafe fo_close routines. This prevents
a scenario where MP-unsafe code gets run without the kernel lock as a consequence of an unlocked system call. OK mpi@, kettenis@
Diffstat (limited to 'sys/kern/sys_pipe.c')
-rw-r--r--sys/kern/sys_pipe.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/sys/kern/sys_pipe.c b/sys/kern/sys_pipe.c
index d9c68a30535..7c8378602a8 100644
--- a/sys/kern/sys_pipe.c
+++ b/sys/kern/sys_pipe.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys_pipe.c,v 1.83 2018/08/13 14:35:29 mpi Exp $ */
+/* $OpenBSD: sys_pipe.c,v 1.84 2018/08/15 13:19:06 visa Exp $ */
/*
* Copyright (c) 1996 John S. Dyson
@@ -757,7 +757,9 @@ pipe_close(struct file *fp, struct proc *p)
fp->f_ops = NULL;
fp->f_data = NULL;
+ KERNEL_LOCK();
pipeclose(cpipe);
+ KERNEL_UNLOCK();
return (0);
}