summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2022-08-19 05:53:20 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2022-08-19 05:53:20 +0000
commit1d3f13c9894a0adb96720b034c851f920defabdc (patch)
tree706307aac30752a3e23904ed31ea498b9dc7e2df /sys
parentf5f628563f365c95662849e07ed71f6cca75419d (diff)
Grab the mutex before iterating on the global list.
Prevent race reported some months ago. ok mlarkin@, jsg@, kn@
Diffstat (limited to 'sys')
-rw-r--r--sys/uvm/uvm_pager.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sys/uvm/uvm_pager.c b/sys/uvm/uvm_pager.c
index ed10740ef86..adb3632045c 100644
--- a/sys/uvm/uvm_pager.c
+++ b/sys/uvm/uvm_pager.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uvm_pager.c,v 1.88 2022/08/15 03:21:04 jsg Exp $ */
+/* $OpenBSD: uvm_pager.c,v 1.89 2022/08/19 05:53:19 mpi Exp $ */
/* $NetBSD: uvm_pager.c,v 1.36 2000/11/27 18:26:41 chs Exp $ */
/*
@@ -209,6 +209,7 @@ uvm_pseg_release(vaddr_t segaddr)
struct uvm_pseg *pseg;
vaddr_t va = 0;
+ mtx_enter(&uvm_pseg_lck);
for (pseg = &psegs[0]; pseg != &psegs[PSEG_NUMSEGS]; pseg++) {
if (pseg->start <= segaddr &&
segaddr < pseg->start + MAX_PAGER_SEGS * MAXBSIZE)
@@ -222,7 +223,6 @@ uvm_pseg_release(vaddr_t segaddr)
/* test for no remainder */
KDASSERT(segaddr == pseg->start + id * MAXBSIZE);
- mtx_enter(&uvm_pseg_lck);
KASSERT(UVM_PSEG_INUSE(pseg, id));