]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
[PATCH] Fix MPOL_F_VERIFY
authorAndi Kleen <ak@suse.de>
Tue, 13 Sep 2005 12:01:08 +0000 (14:01 +0200)
committerChris Wright <chrisw@osdl.org>
Sat, 17 Sep 2005 01:01:58 +0000 (18:01 -0700)
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.

Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Chris Wright <chrisw@osdl.org>
mm/mempolicy.c

index b4eababc8198790961ead62cf421b2ac2c21aaf5..54b522c7b015615afdb8c41616aaca7693329787 100644 (file)
@@ -333,8 +333,13 @@ check_range(struct mm_struct *mm, unsigned long start, unsigned long end,
                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;