aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/security.h
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-07-31 12:53:58 -0400
committerJames Morris <jmorris@namei.org>2009-08-05 19:02:17 -0400
commit7c73875e7dda627040b12c19b01db634fa7f0fd1 (patch)
treef8f4df20bdcafb1bd981c8a7b0797d13b2625b27 /include/linux/security.h
parent012a5299a29672039f42944a37984558393ef769 (diff)
Capabilities: move cap_file_mmap to commoncap.c
Currently we duplicate the mmap_min_addr test in cap_file_mmap and in security_file_mmap if !CONFIG_SECURITY. This patch moves cap_file_mmap into commoncap.c and then calls that function directly from security_file_mmap ifndef CONFIG_SECURITY like all of the other capability checks are done. Signed-off-by: Eric Paris <eparis@redhat.com> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: James Morris <jmorris@namei.org>
Diffstat (limited to 'include/linux/security.h')
-rw-r--r--include/linux/security.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/include/linux/security.h b/include/linux/security.h
index 145909165dbf..963a48fc3005 100644
--- a/include/linux/security.h
+++ b/include/linux/security.h
@@ -66,6 +66,9 @@ extern int cap_inode_setxattr(struct dentry *dentry, const char *name,
66extern int cap_inode_removexattr(struct dentry *dentry, const char *name); 66extern int cap_inode_removexattr(struct dentry *dentry, const char *name);
67extern int cap_inode_need_killpriv(struct dentry *dentry); 67extern int cap_inode_need_killpriv(struct dentry *dentry);
68extern int cap_inode_killpriv(struct dentry *dentry); 68extern int cap_inode_killpriv(struct dentry *dentry);
69extern int cap_file_mmap(struct file *file, unsigned long reqprot,
70 unsigned long prot, unsigned long flags,
71 unsigned long addr, unsigned long addr_only);
69extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags); 72extern int cap_task_fix_setuid(struct cred *new, const struct cred *old, int flags);
70extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3, 73extern int cap_task_prctl(int option, unsigned long arg2, unsigned long arg3,
71 unsigned long arg4, unsigned long arg5); 74 unsigned long arg4, unsigned long arg5);
@@ -2197,9 +2200,7 @@ static inline int security_file_mmap(struct file *file, unsigned long reqprot,
2197 unsigned long addr, 2200 unsigned long addr,
2198 unsigned long addr_only) 2201 unsigned long addr_only)
2199{ 2202{
2200 if ((addr < mmap_min_addr) && !capable(CAP_SYS_RAWIO)) 2203 return cap_file_mmap(file, reqprot, prot, flags, addr, addr_only);
2201 return -EACCES;
2202 return 0;
2203} 2204}
2204 2205
2205static inline int security_file_mprotect(struct vm_area_struct *vma, 2206static inline int security_file_mprotect(struct vm_area_struct *vma,