aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHelge Deller <deller@gmx.de>2006-12-19 13:28:33 -0500
committerKyle McMartin <kyle@minerva.i.cabal.ca>2007-06-21 17:46:20 -0400
commit06b32f3ab6df4c7489729f94bdc7093c72681d4b (patch)
tree07fabea840fa598e510b4da899ef7f5b06282683
parentd2f1c0fa2b346769ac35559ae3bafccf151dd446 (diff)
[PARISC] Handle wrapping in expand_upwards()
Function expand_upwards() did not guarded against wrapping around to address 0. This fixes the adjtimex02 testcase from the Linux Test Project on a 32bit PARISC kernel. [expand_upwards is only used on parisc and ia64; it looks like it does the right thing on both. --kyle] Signed-off-by: Helge Deller <deller@gmx.de> Cc: Tony Luck <tony.luck@intel.com> Signed-off-by: Kyle McMartin <kyle@parisc-linux.org>
-rw-r--r--mm/mmap.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 68b9ad2ef1d6..906ed402f7ca 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1536,9 +1536,14 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address)
1536 * vma->vm_start/vm_end cannot change under us because the caller 1536 * vma->vm_start/vm_end cannot change under us because the caller
1537 * is required to hold the mmap_sem in read mode. We need the 1537 * is required to hold the mmap_sem in read mode. We need the
1538 * anon_vma lock to serialize against concurrent expand_stacks. 1538 * anon_vma lock to serialize against concurrent expand_stacks.
1539 * Also guard against wrapping around to address 0.
1539 */ 1540 */
1540 address += 4 + PAGE_SIZE - 1; 1541 if (address < PAGE_ALIGN(address+4))
1541 address &= PAGE_MASK; 1542 address = PAGE_ALIGN(address+4);
1543 else {
1544 anon_vma_unlock(vma);
1545 return -ENOMEM;
1546 }
1542 error = 0; 1547 error = 0;
1543 1548
1544 /* Somebody else might have raced and expanded it already */ 1549 /* Somebody else might have raced and expanded it already */