Message ID | 1318342628-32016-3-git-send-email-paolo.pisati@canonical.com |
---|---|
State | New |
Headers | show |
diff --git a/mm/mmap.c b/mm/mmap.c index 974ecc0..dcd3dcc 100644 --- a/mm/mmap.c +++ b/mm/mmap.c @@ -1644,10 +1644,13 @@ static inline int expand_downwards(struct vm_area_struct *vma, size = vma->vm_end - address; grow = (vma->vm_start - address) >> PAGE_SHIFT; - error = acct_stack_growth(vma, size, grow); - if (!error) { - vma->vm_start = address; - vma->vm_pgoff -= grow; + error = -ENOMEM; + if (grow <= vma->vm_pgoff) { + error = acct_stack_growth(vma, size, grow); + if (!error) { + vma->vm_start = address; + vma->vm_pgoff -= grow; + } } } anon_vma_unlock(vma);