diff options
Diffstat (limited to 'mm')
-rw-r--r-- | mm/mmap.c | 4 | ||||
-rw-r--r-- | mm/mremap.c | 13 | ||||
-rw-r--r-- | mm/nommu.c | 2 |
3 files changed, 14 insertions, 5 deletions
@@ -1023,10 +1023,10 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr, | |||
1023 | } | 1023 | } |
1024 | } | 1024 | } |
1025 | 1025 | ||
1026 | error = security_file_mmap(file, reqprot, prot, flags); | 1026 | error = security_file_mmap(file, reqprot, prot, flags, addr, 0); |
1027 | if (error) | 1027 | if (error) |
1028 | return error; | 1028 | return error; |
1029 | 1029 | ||
1030 | /* Clear old maps */ | 1030 | /* Clear old maps */ |
1031 | error = -ENOMEM; | 1031 | error = -ENOMEM; |
1032 | munmap_back: | 1032 | munmap_back: |
diff --git a/mm/mremap.c b/mm/mremap.c index 5d4bd4f95b8e..bc7c52efc71b 100644 --- a/mm/mremap.c +++ b/mm/mremap.c | |||
@@ -291,6 +291,10 @@ unsigned long do_mremap(unsigned long addr, | |||
291 | if ((addr <= new_addr) && (addr+old_len) > new_addr) | 291 | if ((addr <= new_addr) && (addr+old_len) > new_addr) |
292 | goto out; | 292 | goto out; |
293 | 293 | ||
294 | ret = security_file_mmap(0, 0, 0, 0, new_addr, 1); | ||
295 | if (ret) | ||
296 | goto out; | ||
297 | |||
294 | ret = do_munmap(mm, new_addr, new_len); | 298 | ret = do_munmap(mm, new_addr, new_len); |
295 | if (ret) | 299 | if (ret) |
296 | goto out; | 300 | goto out; |
@@ -390,8 +394,13 @@ unsigned long do_mremap(unsigned long addr, | |||
390 | 394 | ||
391 | new_addr = get_unmapped_area(vma->vm_file, 0, new_len, | 395 | new_addr = get_unmapped_area(vma->vm_file, 0, new_len, |
392 | vma->vm_pgoff, map_flags); | 396 | vma->vm_pgoff, map_flags); |
393 | ret = new_addr; | 397 | if (new_addr & ~PAGE_MASK) { |
394 | if (new_addr & ~PAGE_MASK) | 398 | ret = new_addr; |
399 | goto out; | ||
400 | } | ||
401 | |||
402 | ret = security_file_mmap(0, 0, 0, 0, new_addr, 1); | ||
403 | if (ret) | ||
395 | goto out; | 404 | goto out; |
396 | } | 405 | } |
397 | ret = move_vma(vma, addr, old_len, new_len, new_addr); | 406 | ret = move_vma(vma, addr, old_len, new_len, new_addr); |
diff --git a/mm/nommu.c b/mm/nommu.c index 2b16b00a5b11..989e2e9af5c3 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -639,7 +639,7 @@ static int validate_mmap_request(struct file *file, | |||
639 | } | 639 | } |
640 | 640 | ||
641 | /* allow the security API to have its say */ | 641 | /* allow the security API to have its say */ |
642 | ret = security_file_mmap(file, reqprot, prot, flags); | 642 | ret = security_file_mmap(file, reqprot, prot, flags, addr, 0); |
643 | if (ret < 0) | 643 | if (ret < 0) |
644 | return ret; | 644 | return ret; |
645 | 645 | ||