aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Waterman <waterman@eecs.berkeley.edu>2014-06-12 15:29:56 -0700
committerAndrew Waterman <waterman@eecs.berkeley.edu>2014-06-12 15:29:56 -0700
commita421961a417d0cb1a4201b05e86b460f5a67e588 (patch)
tree05179acb3901abfd4cfb21a24139209caf68fe21
parent2934c5a65f85876f056edcd3a8c8ea3e7a8c442e (diff)
downloadpk-a421961a417d0cb1a4201b05e86b460f5a67e588.zip
pk-a421961a417d0cb1a4201b05e86b460f5a67e588.tar.gz
pk-a421961a417d0cb1a4201b05e86b460f5a67e588.tar.bz2
Fix file reference counting bug in physical address mode
-rw-r--r--pk/vm.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/pk/vm.c b/pk/vm.c
index 783153c..53dd971 100644
--- a/pk/vm.c
+++ b/pk/vm.c
@@ -247,12 +247,12 @@ uintptr_t __do_mmap(uintptr_t addr, size_t length, int prot, int flags, file_t*
*pte = (pte_t)v;
}
+ if (f) file_incref(f);
+
if (!have_vm || (flags & MAP_POPULATE))
for (uintptr_t a = addr; a < addr + length; a += RISCV_PGSIZE)
kassert(__handle_page_fault(a, prot) == 0);
- if (f) file_incref(f);
-
return addr;
}