aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 1ec0f6e9c0d8..01f9793591f6 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -937,9 +937,10 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
937 /* mlock MCL_FUTURE? */ 937 /* mlock MCL_FUTURE? */
938 if (vm_flags & VM_LOCKED) { 938 if (vm_flags & VM_LOCKED) {
939 unsigned long locked, lock_limit; 939 unsigned long locked, lock_limit;
940 locked = mm->locked_vm << PAGE_SHIFT; 940 locked = len >> PAGE_SHIFT;
941 locked += mm->locked_vm;
941 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; 942 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
942 locked += len; 943 lock_limit >>= PAGE_SHIFT;
943 if (locked > lock_limit && !capable(CAP_IPC_LOCK)) 944 if (locked > lock_limit && !capable(CAP_IPC_LOCK))
944 return -EAGAIN; 945 return -EAGAIN;
945 } 946 }
@@ -1822,9 +1823,10 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
1822 */ 1823 */
1823 if (mm->def_flags & VM_LOCKED) { 1824 if (mm->def_flags & VM_LOCKED) {
1824 unsigned long locked, lock_limit; 1825 unsigned long locked, lock_limit;
1825 locked = mm->locked_vm << PAGE_SHIFT; 1826 locked = len >> PAGE_SHIFT;
1827 locked += mm->locked_vm;
1826 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur; 1828 lock_limit = current->signal->rlim[RLIMIT_MEMLOCK].rlim_cur;
1827 locked += len; 1829 lock_limit >>= PAGE_SHIFT;
1828 if (locked > lock_limit && !capable(CAP_IPC_LOCK)) 1830 if (locked > lock_limit && !capable(CAP_IPC_LOCK))
1829 return -EAGAIN; 1831 return -EAGAIN;
1830 } 1832 }