lkml.org 
[lkml]   [2007]   [Aug]   [8]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
DateWed, 08 Aug 2007 19:16:27 +0200
FromAndreas Gruenbacher <>
Subject[RFC 05/10] Use vfs_permission instead of file_permission in sys_fchdir
Create a temporary vfs_lookup object, and use vfs_permission instead
of file_permission() in sys_fchdir().

Signed-off-by: Andreas Gruenbacher <ag@bestbits.at>

---
 fs/open.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
--- a/fs/open.c
+++ b/fs/open.c
@@ -501,9 +501,7 @@ out:
 asmlinkage long sys_fchdir(unsigned int fd)
 {
 	struct file *file;
-	struct dentry *dentry;
-	struct inode *inode;
-	struct vfsmount *mnt;
+	struct vfs_lookup lookup;
 	int error;
 
 	error = -EBADF;
@@ -511,17 +509,16 @@ asmlinkage long sys_fchdir(unsigned int 
 	if (!file)
 		goto out;
 
-	dentry = file->f_path.dentry;
-	mnt = file->f_path.mnt;
-	inode = dentry->d_inode;
+	lookup.path = file->f_path;
+	lookup.flags = 0;
 
 	error = -ENOTDIR;
-	if (!S_ISDIR(inode->i_mode))
+	if (!S_ISDIR(lookup.path.dentry->d_inode->i_mode))
 		goto out_putf;
 
-	error = file_permission(file, MAY_EXEC);
+	error = vfs_permission(&lookup, MAY_EXEC);
 	if (!error)
-		set_fs_pwd(current->fs, mnt, dentry);
+		set_fs_pwd(current->fs, lookup.path.mnt, lookup.path.dentry);
 out_putf:
 	fput(file);
 out:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-08-08 19:23    [from the cache]
©2003-2008