Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=06b32f3ab6df4c7489729f94bdc7093c72681d4b
Commit:     06b32f3ab6df4c7489729f94bdc7093c72681d4b
Parent:     d2f1c0fa2b346769ac35559ae3bafccf151dd446
Author:     Helge Deller <[EMAIL PROTECTED]>
AuthorDate: Tue Dec 19 19:28:33 2006 +0100
Committer:  Kyle McMartin <[EMAIL PROTECTED]>
CommitDate: Thu Jun 21 17:46:20 2007 -0400

    [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 <[EMAIL PROTECTED]>
    Cc: Tony Luck <[EMAIL PROTECTED]>
    Signed-off-by: Kyle McMartin <[EMAIL PROTECTED]>
---
 mm/mmap.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/mm/mmap.c b/mm/mmap.c
index 68b9ad2..906ed40 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1536,9 +1536,14 @@ int expand_upwards(struct vm_area_struct *vma, unsigned 
long address)
         * vma->vm_start/vm_end cannot change under us because the caller
         * is required to hold the mmap_sem in read mode.  We need the
         * anon_vma lock to serialize against concurrent expand_stacks.
+        * Also guard against wrapping around to address 0.
         */
-       address += 4 + PAGE_SIZE - 1;
-       address &= PAGE_MASK;
+       if (address < PAGE_ALIGN(address+4))
+               address = PAGE_ALIGN(address+4);
+       else {
+               anon_vma_unlock(vma);
+               return -ENOMEM;
+       }
        error = 0;
 
        /* Somebody else might have raced and expanded it already */
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to