| 1 |
From stable-bounces@linux.kernel.org Tue Sep 13 05:01:26 2005
|
| 2 |
From: Andi Kleen <ak@suse.de>
|
| 3 |
To: stable@kernel.org
|
| 4 |
Date: Tue, 13 Sep 2005 14:01:08 +0200
|
| 5 |
Cc: linux-kernel@vger.kernel.org
|
| 6 |
Subject: [PATCH] Fix MPOL_F_VERIFY
|
| 7 |
|
| 8 |
There was a pretty bad bug in there that the code would
|
| 9 |
always check the full VMA, not the range the user requested.
|
| 10 |
|
| 11 |
When the VMA to be checked was merged with the previous VMA this
|
| 12 |
could lead to spurious failures.
|
| 13 |
|
| 14 |
Signed-off-by: Andi Kleen <ak@suse.de>
|
| 15 |
Signed-off-by: Chris Wright <chrisw@osdl.org>
|
| 16 |
---
|
| 17 |
mm/mempolicy.c | 7 ++++++-
|
| 18 |
1 files changed, 6 insertions(+), 1 deletion(-)
|
| 19 |
|
| 20 |
Index: linux-2.6.13.y/mm/mempolicy.c
|
| 21 |
===================================================================
|
| 22 |
--- linux-2.6.13.y.orig/mm/mempolicy.c
|
| 23 |
+++ linux-2.6.13.y/mm/mempolicy.c
|
| 24 |
@@ -333,8 +333,13 @@ check_range(struct mm_struct *mm, unsign
|
| 25 |
if (prev && prev->vm_end < vma->vm_start)
|
| 26 |
return ERR_PTR(-EFAULT);
|
| 27 |
if ((flags & MPOL_MF_STRICT) && !is_vm_hugetlb_page(vma)) {
|
| 28 |
+ unsigned long endvma = vma->vm_end;
|
| 29 |
+ if (endvma > end)
|
| 30 |
+ endvma = end;
|
| 31 |
+ if (vma->vm_start > start)
|
| 32 |
+ start = vma->vm_start;
|
| 33 |
err = check_pgd_range(vma->vm_mm,
|
| 34 |
- vma->vm_start, vma->vm_end, nodes);
|
| 35 |
+ start, endvma, nodes);
|
| 36 |
if (err) {
|
| 37 |
first = ERR_PTR(err);
|
| 38 |
break;
|