Message ID | 1318417374-5540-3-git-send-email-paolo.pisati@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/mm/mmap.c b/mm/mmap.c index 745191a6a..0b8fafde 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1848,9 +1848,12 @@ int expand_upwards(struct vm_area_struct *vma, unsigned long address) size = address - vma->vm_start; grow = (address - vma->vm_end) >> PAGE_SHIFT; - error = acct_stack_growth(vma, size, grow); - if (!error) - vma->vm_end = address; + error = -ENOMEM; + if (vma->vm_pgoff + (size >> PAGE_SHIFT) >= vma->vm_pgoff) { + error = acct_stack_growth(vma, size, grow); + if (!error) + vma->vm_end = address; + } } anon_vma_unlock(vma); return error;