aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorEric Paris <eparis@redhat.com>2009-07-31 12:53:58 -0400
committerJames Morris <jmorris@namei.org>2009-08-17 01:08:35 -0400
commit9c0d90103c7e0eb6e638e5b649e9f6d8d9c1b4b3 (patch)
treeba7c5fbed87e6ad6c395f4ca560e2e85d153a5dc /include
parent894ef820b10d77e2d6d717342fc408bdd9825139 (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')
-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 5eff459b3833..ac4bc3760b46 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,