aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 7b36aa7cc89a..0bb74ca2139d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2099,14 +2099,17 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns
2099{ 2099{
2100 struct mm_struct *mm = vma->vm_mm; 2100 struct mm_struct *mm = vma->vm_mm;
2101 struct rlimit *rlim = current->signal->rlim; 2101 struct rlimit *rlim = current->signal->rlim;
2102 unsigned long new_start; 2102 unsigned long new_start, actual_size;
2103 2103
2104 /* address space limit tests */ 2104 /* address space limit tests */
2105 if (!may_expand_vm(mm, grow)) 2105 if (!may_expand_vm(mm, grow))
2106 return -ENOMEM; 2106 return -ENOMEM;
2107 2107
2108 /* Stack limit test */ 2108 /* Stack limit test */
2109 if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur)) 2109 actual_size = size;
2110 if (size && (vma->vm_flags & (VM_GROWSUP | VM_GROWSDOWN)))
2111 actual_size -= PAGE_SIZE;
2112 if (actual_size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur))
2110 return -ENOMEM; 2113 return -ENOMEM;
2111 2114
2112 /* mlock limit tests */ 2115 /* mlock limit tests */