From f0603682a30a0929151bd146ad0bf3edca58d200 Mon Sep 17 00:00:00 2001 From: Linus Torvalds Date: Fri, 20 Aug 2010 16:49:40 -0700 Subject: [PATCH] --- yaml --- r: 209697 b: refs/heads/master c: 0e8e50e20c837eeec8323bba7dcd25fe5479194c h: refs/heads/master i: 209695: fdba08ef5378f11f9a872b87c99b9476fc77de87 v: v3 --- [refs] | 2 +- trunk/mm/memory.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/[refs] b/[refs] index fc3cf9691b02..13c6ca826202 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 7798330ac8114c731cfab83e634c6ecedaa233d7 +refs/heads/master: 0e8e50e20c837eeec8323bba7dcd25fe5479194c diff --git a/trunk/mm/memory.c b/trunk/mm/memory.c index b6e5fd23cc5a..2ed2267439df 100644 --- a/trunk/mm/memory.c +++ b/trunk/mm/memory.c @@ -2770,11 +2770,18 @@ static inline int check_stack_guard_page(struct vm_area_struct *vma, unsigned lo { address &= PAGE_MASK; if ((vma->vm_flags & VM_GROWSDOWN) && address == vma->vm_start) { - address -= PAGE_SIZE; - if (find_vma(vma->vm_mm, address) != vma) - return -ENOMEM; + struct vm_area_struct *prev = vma->vm_prev; + + /* + * Is there a mapping abutting this one below? + * + * That's only ok if it's the same stack mapping + * that has gotten split.. + */ + if (prev && prev->vm_end == address) + return prev->vm_flags & VM_GROWSDOWN ? 0 : -ENOMEM; - expand_stack(vma, address); + expand_stack(vma, address - PAGE_SIZE); } return 0; }