aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-05-30 17:13:15 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-06-01 10:37:16 -0400
commit9ac4ed4bd0adec75db13a4b08a39a3918ec0e3c9 (patch)
tree23aba68ec121692cd6f0449535524b6586e8914f /mm/mmap.c
parent8b3ec6814c83d76b85bd13badc48552836c24839 (diff)
move security_mmap_addr() to saner place
it really should be done by get_unmapped_area(); that cuts down on the amount of callers considerably and it's the right place for that stuff anyway. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 34b280f4238d..131521e12f13 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -978,7 +978,6 @@ static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
978 struct mm_struct * mm = current->mm; 978 struct mm_struct * mm = current->mm;
979 struct inode *inode; 979 struct inode *inode;
980 vm_flags_t vm_flags; 980 vm_flags_t vm_flags;
981 int error;
982 981
983 /* 982 /*
984 * Does the application expect PROT_READ to imply PROT_EXEC? 983 * Does the application expect PROT_READ to imply PROT_EXEC?
@@ -1100,10 +1099,6 @@ static unsigned long do_mmap_pgoff(struct file *file, unsigned long addr,
1100 } 1099 }
1101 } 1100 }
1102 1101
1103 error = security_mmap_addr(addr);
1104 if (error)
1105 return error;
1106
1107 return mmap_region(file, addr, len, flags, vm_flags, pgoff); 1102 return mmap_region(file, addr, len, flags, vm_flags, pgoff);
1108} 1103}
1109 1104
@@ -1633,7 +1628,9 @@ get_unmapped_area(struct file *file, unsigned long addr, unsigned long len,
1633 if (addr & ~PAGE_MASK) 1628 if (addr & ~PAGE_MASK)
1634 return -EINVAL; 1629 return -EINVAL;
1635 1630
1636 return arch_rebalance_pgtables(addr, len); 1631 addr = arch_rebalance_pgtables(addr, len);
1632 error = security_mmap_addr(addr);
1633 return error ? error : addr;
1637} 1634}
1638 1635
1639EXPORT_SYMBOL(get_unmapped_area); 1636EXPORT_SYMBOL(get_unmapped_area);
@@ -2210,10 +2207,6 @@ static unsigned long do_brk(unsigned long addr, unsigned long len)
2210 if (!len) 2207 if (!len)
2211 return addr; 2208 return addr;
2212 2209
2213 error = security_mmap_addr(addr);
2214 if (error)
2215 return error;
2216
2217 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags; 2210 flags = VM_DATA_DEFAULT_FLAGS | VM_ACCOUNT | mm->def_flags;
2218 2211
2219 error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED); 2212 error = get_unmapped_area(NULL, addr, len, 0, MAP_FIXED);
@@ -2566,10 +2559,6 @@ int install_special_mapping(struct mm_struct *mm,
2566 vma->vm_ops = &special_mapping_vmops; 2559 vma->vm_ops = &special_mapping_vmops;
2567 vma->vm_private_data = pages; 2560 vma->vm_private_data = pages;
2568 2561
2569 ret = security_mmap_addr(vma->vm_start);
2570 if (ret)
2571 goto out;
2572
2573 ret = insert_vm_struct(mm, vma); 2562 ret = insert_vm_struct(mm, vma);
2574 if (ret) 2563 if (ret)
2575 goto out; 2564 goto out;