summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2018-05-29 08:28:36 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2018-05-29 08:28:36 +0000
commitb904a189a43174c76410825e9ba03618b4e1915f (patch)
tree47065aca7d7cd847b1c55be70e787f44d3c717ed /sys
parenteb63c7dc9b7e201a2c1a1df6ac95f25038db858d (diff)
`f_mtx' must block interrupts as long as it is taken w/ and w/o the
KERNEL_LOCK(). Otherwise a deadlock can occur as found the hardway by tb@. ok tb@, kettenis@, visa@
Diffstat (limited to 'sys')
-rw-r--r--sys/kern/kern_descrip.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/kern/kern_descrip.c b/sys/kern/kern_descrip.c
index 2d048683cd4..746626bb5f0 100644
--- a/sys/kern/kern_descrip.c
+++ b/sys/kern/kern_descrip.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kern_descrip.c,v 1.159 2018/05/28 08:55:11 mpi Exp $ */
+/* $OpenBSD: kern_descrip.c,v 1.160 2018/05/29 08:28:35 mpi Exp $ */
/* $NetBSD: kern_descrip.c,v 1.42 1996/03/30 22:24:38 christos Exp $ */
/*
@@ -958,7 +958,11 @@ restart:
*/
numfiles++;
fp = pool_get(&file_pool, PR_WAITOK|PR_ZERO);
- mtx_init(&fp->f_mtx, IPL_NONE);
+ /*
+ * We need to block interrupts as long as `f_mtx' is being taken
+ * with and without the KERNEL_LOCK().
+ */
+ mtx_init(&fp->f_mtx, IPL_VM);
fp->f_iflags = FIF_LARVAL;
if ((fq = p->p_fd->fd_ofiles[0]) != NULL) {
LIST_INSERT_AFTER(fq, fp, f_list);