aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSverker Eriksson <[email protected]>2013-09-13 17:37:44 +0200
committerSverker Eriksson <[email protected]>2013-09-30 17:45:46 +0200
commit4ba6824a90943e74e8fdd02f3cb695931093bcca (patch)
treeef9c70c72a5bb606e01599c2408f10bc2c7c540a
parentb9e82ba0be1364c64e90274d5e9bf37f78b676ee (diff)
downloadotp-4ba6824a90943e74e8fdd02f3cb695931093bcca.tar.gz
otp-4ba6824a90943e74e8fdd02f3cb695931093bcca.tar.bz2
otp-4ba6824a90943e74e8fdd02f3cb695931093bcca.zip
erts: Fix race bug in erts_munmap
Must keep mutex to serialize (un)reserve ops.
-rw-r--r--erts/emulator/sys/common/erl_mmap.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/erts/emulator/sys/common/erl_mmap.c b/erts/emulator/sys/common/erl_mmap.c
index 93a95e5eef..317e3ec391 100644
--- a/erts/emulator/sys/common/erl_mmap.c
+++ b/erts/emulator/sys/common/erl_mmap.c
@@ -1762,12 +1762,12 @@ erts_munmap(Uint32 flags, void *ptr, UWord size)
supercarrier_success: {
UWord unres_sz;
- erts_smp_mtx_unlock(&mmap_state.mtx);
-
ERTS_MMAP_ASSERT(size >= ad_sz);
unres_sz = size - ad_sz;
if (unres_sz)
mmap_state.unreserve_physical(((char *) ptr) + ad_sz, unres_sz);
+
+ erts_smp_mtx_unlock(&mmap_state.mtx);
}
}
}