summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCody Cutler <[email protected]>2016-09-26 12:21:01 -0400
committerCody Cutler <[email protected]>2016-09-26 12:34:08 -0400
commitffe444926e4685301c35b17b254ef2067560f401 (patch)
tree5185d7ff10d3a64402415a692ec8583d4ff81738
parent91fd3470b0c48b93f14b9f941ee3ffd753b7441c (diff)
downloadxv6-labs-ffe444926e4685301c35b17b254ef2067560f401.tar.gz
xv6-labs-ffe444926e4685301c35b17b254ef2067560f401.tar.bz2
xv6-labs-ffe444926e4685301c35b17b254ef2067560f401.zip
fix possible memory leak in deallocuvm
when a zero PDE is encountered while searching for present PTEs to free, resume searching at first entry of the next page table instead of the current entry of the next page table.
-rw-r--r--vm.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/vm.c b/vm.c
index d9aaa7e..764512c 100644
--- a/vm.c
+++ b/vm.c
@@ -266,7 +266,7 @@ deallocuvm(pde_t *pgdir, uint oldsz, uint newsz)
for(; a < oldsz; a += PGSIZE){
pte = walkpgdir(pgdir, (char*)a, 0);
if(!pte)
- a += (NPTENTRIES - 1) * PGSIZE;
+ a = PGADDR(PDX(a) + 1, 0, 0) - PGSIZE;
else if((*pte & PTE_P) != 0){
pa = PTE_ADDR(*pte);
if(pa == 0)