ARM: prevent VM_GROWSDOWN mmaps extending below FIRST_USER_ADDRESS
authorRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 16 May 2012 14:19:20 +0000 (15:19 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Wed, 16 May 2012 14:20:59 +0000 (15:20 +0100)
Cc: <stable@vger.kernel.org>
Reported-by: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mm/fault.c

index f0746753336546448a3512e297444fe3137f1c07..5bb48356d217292a074b006cc432447da6880ffd 100644 (file)
@@ -247,7 +247,9 @@ good_area:
        return handle_mm_fault(mm, vma, addr & PAGE_MASK, flags);
 
 check_stack:
-       if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
+       /* Don't allow expansion below FIRST_USER_ADDRESS */
+       if (vma->vm_flags & VM_GROWSDOWN &&
+           addr >= FIRST_USER_ADDRESS && !expand_stack(vma, addr))
                goto good_area;
 out:
        return fault;