Skip to contentSkip to conversation

Fix MPOL_F_VERIFY

PATCH In review Andi Kleen 2 participants 2 messages Sep 13, 2005

lore
Share & tools
lore

Andi Kleen

author
#0 lore raw

PATCH 1/1 Fix MPOL_F_VERIFY

Fix MPOL_F_VERIFY

There was a pretty bad bug in there that the code would always check the full VMA, not the range the user requested.

When the VMA to be checked was merged with the previous VMA this could lead to spurious failures.

mm/mempolicy.c +6 -1
Index: linux-2.6.13-work/mm/mempolicy.c
===================================================================
@@ -338,8 +338,13 @@ check_range(struct mm_struct *mm, unsign
 		if (prev && prev->vm_end < vma->vm_start)
 			return ERR_PTR(-EFAULT);
 		if ((flags & MPOL_MF_STRICT) && !is_vm_hugetlb_page(vma)) {
+			unsigned long endvma = vma->vm_end; 
+			if (endvma > end)
+				endvma = end;
+			if (vma->vm_start > start)
+				start = vma->vm_start;
 			err = check_pgd_range(vma->vm_mm,
-					   vma->vm_start, vma->vm_end, nodes);
+					   start, endvma, nodes);
 			if (err) {
 				first = ERR_PTR(err);
 				break;