Skip to content

Commit 3bfa784

Browse files
author
Al Viro
committed
kill file_permission() completely
convert the last remaining caller to inode_permission() Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 1b5d783 commit 3bfa784

3 files changed

Lines changed: 2 additions & 20 deletions

File tree

‎fs/namei.c‎

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -303,23 +303,6 @@ int inode_permission(struct inode *inode, int mask)
303303
return security_inode_permission(inode, mask);
304304
}
305305

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-
*/
318-
int file_permission(struct file *file, int mask)
319-
{
320-
return inode_permission(file->f_path.dentry->d_inode, mask);
321-
}
322-
323306
/*
324307
* get_write_access() gets write permission for a file.
325308
* put_write_access() releases this write permission.
@@ -3405,7 +3388,6 @@ EXPORT_SYMBOL(kern_path_parent);
34053388
EXPORT_SYMBOL(kern_path);
34063389
EXPORT_SYMBOL(vfs_path_lookup);
34073390
EXPORT_SYMBOL(inode_permission);
3408-
EXPORT_SYMBOL(file_permission);
34093391
EXPORT_SYMBOL(unlock_rename);
34103392
EXPORT_SYMBOL(vfs_create);
34113393
EXPORT_SYMBOL(vfs_follow_link);

‎include/linux/fs.h‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1490,7 +1490,6 @@ extern void dentry_unhash(struct dentry *dentry);
14901490
/*
14911491
* VFS file helper functions.
14921492
*/
1493-
extern int file_permission(struct file *, int);
14941493
extern void inode_init_owner(struct inode *inode, const struct inode *dir,
14951494
mode_t mode);
14961495
/*

‎kernel/cgroup.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3542,7 +3542,8 @@ static int cgroup_write_event_control(struct cgroup *cgrp, struct cftype *cft,
35423542
}
35433543

35443544
/* 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);
35463547
if (ret < 0)
35473548
goto fail;
35483549

0 commit comments

Comments
 (0)