aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index da15a79b1441..39a68ddf38bd 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -936,6 +936,19 @@ void vm_stat_account(struct mm_struct *mm, unsigned long flags,
936#endif /* CONFIG_PROC_FS */ 936#endif /* CONFIG_PROC_FS */
937 937
938/* 938/*
939 * If a hint addr is less than mmap_min_addr change hint to be as
940 * low as possible but still greater than mmap_min_addr
941 */
942static inline unsigned long round_hint_to_min(unsigned long hint)
943{
944 hint &= PAGE_MASK;
945 if (((void *)hint != NULL) &&
946 (hint < mmap_min_addr))
947 return PAGE_ALIGN(mmap_min_addr);
948 return hint;
949}
950
951/*
939 * The caller must hold down_write(&current->mm->mmap_sem). 952 * The caller must hold down_write(&current->mm->mmap_sem).
940 */ 953 */
941 954
@@ -1235,7 +1248,7 @@ munmap_back:
1235 */ 1248 */
1236 if (accountable_mapping(file, vm_flags)) { 1249 if (accountable_mapping(file, vm_flags)) {
1237 charged = len >> PAGE_SHIFT; 1250 charged = len >> PAGE_SHIFT;
1238 if (security_vm_enough_memory(charged)) 1251 if (security_vm_enough_memory_mm(mm, charged))
1239 return -ENOMEM; 1252 return -ENOMEM;
1240 vm_flags |= VM_ACCOUNT; 1253 vm_flags |= VM_ACCOUNT;
1241 } 1254 }
@@ -2180,7 +2193,7 @@ unsigned long do_brk(unsigned long addr, unsigned long len)
2180 if (mm->map_count > sysctl_max_map_count) 2193 if (mm->map_count > sysctl_max_map_count)
2181 return -ENOMEM; 2194 return -ENOMEM;
2182 2195
2183 if (security_vm_enough_memory(len >> PAGE_SHIFT)) 2196 if (security_vm_enough_memory_mm(mm, len >> PAGE_SHIFT))
2184 return -ENOMEM; 2197 return -ENOMEM;
2185 2198
2186 /* Can we just expand an old private anonymous mapping? */ 2199 /* Can we just expand an old private anonymous mapping? */