aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-05-30 13:30:51 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-05-31 13:11:54 -0400
commite5467859f7f79b69fc49004403009dfdba3bec53 (patch)
tree73b011daf79eeddd61bbcaf65cd197b5e5f6f149 /mm
parentd007794a182bc072a7b7479909dbd0d67ba341be (diff)
split ->file_mmap() into ->mmap_addr()/->mmap_file()
... i.e. file-dependent and address-dependent checks. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c12
-rw-r--r--mm/mremap.c4
-rw-r--r--mm/nommu.c5
3 files changed, 14 insertions, 7 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 83c56624f1f6..49283da9a2ae 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1101,7 +1101,11 @@ static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1101 } 1101 }
1102 } 1102 }
1103 1103
1104 error = security_file_mmap(file, reqprot, prot, flags, addr, 0); 1104 error = security_mmap_addr(addr);
1105 if (error)
1106 return error;
1107
1108 error = security_mmap_file(file, reqprot, prot, flags);
1105 if (error) 1109 if (error)
1106 return error; 1110 return error;
1107 1111
@@ -1817,7 +1821,7 @@ int expand_downwards(struct vm_area_struct *vma,
1817 return -ENOMEM; 1821 return -ENOMEM;
1818 1822
1819 address &= PAGE_MASK; 1823 address &= PAGE_MASK;
1820 error = security_file_mmap(NULL, 0, 0, 0, address, 1); 1824 error = security_mmap_addr(address);
1821 if (error) 1825 if (error)
1822 return error; 1826 return error;
1823 1827
@@ -2205,7 +2209,7 @@ static unsigned long do_brk(unsigned long addr, unsigned long len)
2205 if (!len) 2209 if (!len)
2206 return addr; 2210 return addr;
2207 2211
2208 error = security_file_mmap(NULL, 0, 0, 0, addr, 1); 2212 error = security_mmap_addr(addr);
2209 if (error) 2213 if (error)
2210 return error; 2214 return error;
2211 2215
@@ -2561,7 +2565,7 @@ int install_special_mapping(struct mm_struct *mm,
2561 vma->vm_ops = &special_mapping_vmops; 2565 vma->vm_ops = &special_mapping_vmops;
2562 vma->vm_private_data = pages; 2566 vma->vm_private_data = pages;
2563 2567
2564 ret = security_file_mmap(NULL, 0, 0, 0, vma->vm_start, 1); 2568 ret = security_mmap_addr(vma->vm_start);
2565 if (ret) 2569 if (ret)
2566 goto out; 2570 goto out;
2567 2571
diff --git a/mm/mremap.c b/mm/mremap.c
index 169c53b87749..ebf10892b63d 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -371,7 +371,7 @@ static unsigned long mremap_to(unsigned long addr,
371 if ((addr <= new_addr) && (addr+old_len) > new_addr) 371 if ((addr <= new_addr) && (addr+old_len) > new_addr)
372 goto out; 372 goto out;
373 373
374 ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1); 374 ret = security_mmap_addr(new_addr);
375 if (ret) 375 if (ret)
376 goto out; 376 goto out;
377 377
@@ -532,7 +532,7 @@ SYSCALL_DEFINE5(mremap, unsigned long, addr, unsigned long, old_len,
532 goto out; 532 goto out;
533 } 533 }
534 534
535 ret = security_file_mmap(NULL, 0, 0, 0, new_addr, 1); 535 ret = security_mmap_addr(new_addr);
536 if (ret) 536 if (ret)
537 goto out; 537 goto out;
538 ret = move_vma(vma, addr, old_len, new_len, new_addr); 538 ret = move_vma(vma, addr, old_len, new_len, new_addr);
diff --git a/mm/nommu.c b/mm/nommu.c
index de6084e3a046..acfe419785db 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -1047,7 +1047,10 @@ static int validate_mmap_request(struct file *file,
1047 } 1047 }
1048 1048
1049 /* allow the security API to have its say */ 1049 /* allow the security API to have its say */
1050 ret = security_file_mmap(file, reqprot, prot, flags, addr, 0); 1050 ret = security_mmap_addr(addr);
1051 if (ret < 0)
1052 return ret;
1053 ret = security_mmap_file(file, reqprot, prot, flags);
1051 if (ret < 0) 1054 if (ret < 0)
1052 return ret; 1055 return ret;
1053 1056