diff options
author | Andrew Waterman <waterman@eecs.berkeley.edu> | 2014-06-12 15:29:56 -0700 |
---|---|---|
committer | Andrew Waterman <waterman@eecs.berkeley.edu> | 2014-06-12 15:29:56 -0700 |
commit | a421961a417d0cb1a4201b05e86b460f5a67e588 (patch) | |
tree | 05179acb3901abfd4cfb21a24139209caf68fe21 | |
parent | 2934c5a65f85876f056edcd3a8c8ea3e7a8c442e (diff) | |
download | pk-a421961a417d0cb1a4201b05e86b460f5a67e588.zip pk-a421961a417d0cb1a4201b05e86b460f5a67e588.tar.gz pk-a421961a417d0cb1a4201b05e86b460f5a67e588.tar.bz2 |
Fix file reference counting bug in physical address mode
-rw-r--r-- | pk/vm.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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; } |