aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c18
-rw-r--r--include/linux/fs.h1
-rw-r--r--kernel/cgroup.c3
3 files changed, 2 insertions, 20 deletions
diff --git a/fs/namei.c b/fs/namei.c
index cf2554635a1c..4ad2b781a65c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -303,23 +303,6 @@ int inode_permission(struct inode *inode, int mask)
303 return security_inode_permission(inode, mask); 303 return security_inode_permission(inode, mask);
304} 304}
305 305
306/**
307 * file_permission - check for additional access rights to a given file
308 * @file: file to check access rights for
309 * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
310 *
311 * Used to check for read/write/execute permissions on an already opened
312 * file.
313 *
314 * Note:
315 * Do not use this function in new code. All access checks should
316 * be done using inode_permission().
317 */
318int file_permission(struct file *file, int mask)
319{
320 return inode_permission(file->f_path.dentry->d_inode, mask);
321}
322
323/* 306/*
324 * get_write_access() gets write permission for a file. 307 * get_write_access() gets write permission for a file.
325 * put_write_access() releases this write permission. 308 * put_write_access() releases this write permission.
@@ -3405,7 +3388,6 @@ EXPORT_SYMBOL(kern_path_parent);
3405EXPORT_SYMBOL(kern_path); 3388EXPORT_SYMBOL(kern_path);
3406EXPORT_SYMBOL(vfs_path_lookup); 3389EXPORT_SYMBOL(vfs_path_lookup);
3407EXPORT_SYMBOL(inode_permission); 3390EXPORT_SYMBOL(inode_permission);
3408EXPORT_SYMBOL(file_permission);
3409EXPORT_SYMBOL(unlock_rename); 3391EXPORT_SYMBOL(unlock_rename);
3410EXPORT_SYMBOL(vfs_create); 3392EXPORT_SYMBOL(vfs_create);
3411EXPORT_SYMBOL(vfs_follow_link); 3393EXPORT_SYMBOL(vfs_follow_link);
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a8735e7e1b35..d04e55586a17 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -1490,7 +1490,6 @@ extern void dentry_unhash(struct dentry *dentry);
1490/* 1490/*
1491 * VFS file helper functions. 1491 * VFS file helper functions.
1492 */ 1492 */
1493extern int file_permission(struct file *, int);
1494extern void inode_init_owner(struct inode *inode, const struct inode *dir, 1493extern void inode_init_owner(struct inode *inode, const struct inode *dir,
1495 mode_t mode); 1494 mode_t mode);
1496/* 1495/*
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 2731d115d725..e1c72c0f512b 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -3542,7 +3542,8 @@ static int cgroup_write_event_control(struct cgroup *cgrp, struct cftype *cft,
3542 } 3542 }
3543 3543
3544 /* the process need read permission on control file */ 3544 /* the process need read permission on control file */
3545 ret = file_permission(cfile, MAY_READ); 3545 /* AV: shouldn't we check that it's been opened for read instead? */
3546 ret = inode_permission(cfile->f_path.dentry->d_inode, MAY_READ);
3546 if (ret < 0) 3547 if (ret < 0)
3547 goto fail; 3548 goto fail;
3548 3549