Commit cb23beb55100171646e69e248fb45f10db6e99a4

Authored by Christoph Hellwig
Committed by Al Viro
1 parent 3fb64190aa

kill vfs_permission

With all the nameidata removal there's no point anymore for this helper.
Of the three callers left two will go away with the next lookup series
anyway.

Also add proper kerneldoc to inode_permission as this is the main
permission check routine now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 3 changed files with 16 additions and 21 deletions Side-by-side Diff

... ... @@ -127,7 +127,8 @@
127 127 if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
128 128 goto exit;
129 129  
130   - error = vfs_permission(&nd, MAY_READ | MAY_EXEC | MAY_OPEN);
  130 + error = inode_permission(nd.path.dentry->d_inode,
  131 + MAY_READ | MAY_EXEC | MAY_OPEN);
131 132 if (error)
132 133 goto exit;
133 134  
... ... @@ -680,7 +681,7 @@
680 681 if (nd.path.mnt->mnt_flags & MNT_NOEXEC)
681 682 goto out_path_put;
682 683  
683   - err = vfs_permission(&nd, MAY_EXEC | MAY_OPEN);
  684 + err = inode_permission(nd.path.dentry->d_inode, MAY_EXEC | MAY_OPEN);
684 685 if (err)
685 686 goto out_path_put;
686 687  
... ... @@ -226,6 +226,16 @@
226 226 return -EACCES;
227 227 }
228 228  
  229 +/**
  230 + * inode_permission - check for access rights to a given inode
  231 + * @inode: inode to check permission on
  232 + * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
  233 + *
  234 + * Used to check for read/write/execute permissions on an inode.
  235 + * We use "fsuid" for this, letting us set arbitrary permissions
  236 + * for filesystem access without changing the "normal" uids which
  237 + * are used for other things.
  238 + */
229 239 int inode_permission(struct inode *inode, int mask)
230 240 {
231 241 int retval;
... ... @@ -264,21 +274,6 @@
264 274 }
265 275  
266 276 /**
267   - * vfs_permission - check for access rights to a given path
268   - * @nd: lookup result that describes the path
269   - * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
270   - *
271   - * Used to check for read/write/execute permissions on a path.
272   - * We use "fsuid" for this, letting us set arbitrary permissions
273   - * for filesystem access without changing the "normal" uids which
274   - * are used for other things.
275   - */
276   -int vfs_permission(struct nameidata *nd, int mask)
277   -{
278   - return inode_permission(nd->path.dentry->d_inode, mask);
279   -}
280   -
281   -/**
282 277 * file_permission - check for additional access rights to a given file
283 278 * @file: file to check access rights for
284 279 * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
... ... @@ -288,7 +283,7 @@
288 283 *
289 284 * Note:
290 285 * Do not use this function in new code. All access checks should
291   - * be done using vfs_permission().
  286 + * be done using inode_permission().
292 287 */
293 288 int file_permission(struct file *file, int mask)
294 289 {
... ... @@ -853,7 +848,8 @@
853 848 nd->flags |= LOOKUP_CONTINUE;
854 849 err = exec_permission_lite(inode);
855 850 if (err == -EAGAIN)
856   - err = vfs_permission(nd, MAY_EXEC);
  851 + err = inode_permission(nd->path.dentry->d_inode,
  852 + MAY_EXEC);
857 853 if (err)
858 854 break;
859 855  
... ... @@ -2882,7 +2878,6 @@
2882 2878 EXPORT_SYMBOL(kern_path);
2883 2879 EXPORT_SYMBOL(vfs_path_lookup);
2884 2880 EXPORT_SYMBOL(inode_permission);
2885   -EXPORT_SYMBOL(vfs_permission);
2886 2881 EXPORT_SYMBOL(file_permission);
2887 2882 EXPORT_SYMBOL(unlock_rename);
2888 2883 EXPORT_SYMBOL(vfs_create);
... ... @@ -1212,7 +1212,6 @@
1212 1212 /*
1213 1213 * VFS helper functions..
1214 1214 */
1215   -extern int vfs_permission(struct nameidata *, int);
1216 1215 extern int vfs_create(struct inode *, struct dentry *, int, struct nameidata *);
1217 1216 extern int vfs_mkdir(struct inode *, struct dentry *, int);
1218 1217 extern int vfs_mknod(struct inode *, struct dentry *, int, dev_t);