aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index c646618702cf..31656147128e 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -265,7 +265,7 @@ SYSCALL_DEFINE1(brk, unsigned long, brk)
265 * segment grow beyond its set limit the in case where the limit is 265 * segment grow beyond its set limit the in case where the limit is
266 * not page aligned -Ram Gupta 266 * not page aligned -Ram Gupta
267 */ 267 */
268 rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; 268 rlim = rlimit(RLIMIT_DATA);
269 if (rlim < RLIM_INFINITY && (brk - mm->start_brk) + 269 if (rlim < RLIM_INFINITY && (brk - mm->start_brk) +
270 (mm->end_data - mm->start_data) > rlim) 270 (mm->end_data - mm->start_data) > rlim)
271 goto out; 271 goto out;
@@ -967,7 +967,7 @@ unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
967 unsigned long locked, lock_limit; 967 unsigned long locked, lock_limit;
968 locked = len >> PAGE_SHIFT; 968 locked = len >> PAGE_SHIFT;
969 locked += mm->locked_vm; 969 locked += mm->locked_vm;
970 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; 970 lock_limit = rlimit(RLIMIT_MEMLOCK);
971 lock_limit >>= PAGE_SHIFT; 971 lock_limit >>= PAGE_SHIFT;
972 if (locked > lock_limit && !capable(CAP_IPC_LOCK)) 972 if (locked > lock_limit && !capable(CAP_IPC_LOCK))
973 return -EAGAIN; 973 return -EAGAIN;
@@ -1594,7 +1594,7 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns
1594 return -ENOMEM; 1594 return -ENOMEM;
1595 1595
1596 /* Stack limit test */ 1596 /* Stack limit test */
1597 if (size > rlim[RLIMIT_STACK].rlim_cur) 1597 if (size > ACCESS_ONCE(rlim[RLIMIT_STACK].rlim_cur))
1598 return -ENOMEM; 1598 return -ENOMEM;
1599 1599
1600 /* mlock limit tests */ 1600 /* mlock limit tests */
@@ -1602,7 +1602,8 @@ static int acct_stack_growth(struct vm_area_struct *vma, unsigned long size, uns
1602 unsigned long locked; 1602 unsigned long locked;
1603 unsigned long limit; 1603 unsigned long limit;
1604 locked = mm->locked_vm + grow; 1604 locked = mm->locked_vm + grow;
1605 limit = rlim[RLIMIT_MEMLOCK].rlim_cur >> PAGE_SHIFT; 1605 limit = ACCESS_ONCE(rlim[RLIMIT_MEMLOCK].rlim_cur);
1606 limit >>= PAGE_SHIFT;
1606 if (locked > limit && !capable(CAP_IPC_LOCK)) 1607 if (locked > limit && !capable(CAP_IPC_LOCK))
1607 return -ENOMEM; 1608 return -ENOMEM;
1608 } 1609 }
@@ -2067,7 +2068,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
2067 unsigned long locked, lock_limit; 2068 unsigned long locked, lock_limit;
2068 locked = len >> PAGE_SHIFT; 2069 locked = len >> PAGE_SHIFT;
2069 locked += mm->locked_vm; 2070 locked += mm->locked_vm;
2070 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; 2071 lock_limit = rlimit(RLIMIT_MEMLOCK);
2071 lock_limit >>= PAGE_SHIFT; 2072 lock_limit >>= PAGE_SHIFT;
2072 if (locked > lock_limit && !capable(CAP_IPC_LOCK)) 2073 if (locked > lock_limit && !capable(CAP_IPC_LOCK))
2073 return -EAGAIN; 2074 return -EAGAIN;
@@ -2281,7 +2282,7 @@ int may_expand_vm(struct mm_struct *mm, unsigned long npages)
2281 unsigned long cur = mm->total_vm; /* pages */ 2282 unsigned long cur = mm->total_vm; /* pages */
2282 unsigned long lim; 2283 unsigned long lim;
2283 2284
2284 lim = current->signal->rlim[RLIMIT_AS].rlim_cur >> PAGE_SHIFT; 2285 lim = rlimit(RLIMIT_AS) >> PAGE_SHIFT;
2285 2286
2286 if (cur + npages > lim) 2287 if (cur + npages > lim)
2287 return 0; 2288 return 0;