Skip to contentSkip to conversation

mm: fix unmap_vmas with inner ptlock

PATCH Hugh Dickins 1 participant 1 message Oct 14, 2005 HugeTLB

lore
Share & tools
lore
#0 lore raw

He who lectures others about hugetlbfs truncation might discover that it's got screwed by his very own self. I replaced zap_hugepage_range by unmap_hugepage_range, overlooking that zap used "len" but unmap "end".

---

 fs/hugetlbfs/inode.c |    6 +-----
 1 files changed, 1 insertion(+), 5 deletions(-)
fs/hugetlbfs/inode.c +1 -5
@@ -284,7 +284,6 @@ hugetlb_vmtruncate_list(struct prio_tree
 
 	vma_prio_tree_foreach(vma, &iter, root, h_pgoff, ULONG_MAX) {
 		unsigned long h_vm_pgoff;
-		unsigned long v_length;
 		unsigned long v_offset;
 
 		h_vm_pgoff = vma->vm_pgoff >> (HPAGE_SHIFT - PAGE_SHIFT);
@@ -295,11 +294,8 @@ hugetlb_vmtruncate_list(struct prio_tree
 		if (h_vm_pgoff >= h_pgoff)
 			v_offset = 0;
 
-		v_length = vma->vm_end - vma->vm_start;
-
 		unmap_hugepage_range(vma,
-				vma->vm_start + v_offset,
-				v_length - v_offset);
+				vma->vm_start + v_offset, vma->vm_end);
 	}
 }