diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2008-07-16 15:51:03 +0200 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2008-07-27 02:53:19 +0200 |
commit | 8bb79224b87aab92071e94d46e70bd160d89bf34 (patch) | |
tree | dab47cbb434876e5916f18b738ef8bd3fe1e1ce1 /fs | |
parent | [patch 5/5] vfs: remove mode parameter from vfs_symlink() (diff) | |
download | linux-8bb79224b87aab92071e94d46e70bd160d89bf34.tar.xz linux-8bb79224b87aab92071e94d46e70bd160d89bf34.zip |
[PATCH] permission checks for chdir need special treatment only on the last step
... so we ought to pass MAY_CHDIR to vfs_permission() instead of having
it triggered on every step of preceding pathname resolution. LOOKUP_CHDIR
is killed by that.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/namei.c | 2 | ||||
-rw-r--r-- | fs/open.c | 5 |
2 files changed, 2 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c index ae0e56fdb742..6c76e1ee9c45 100644 --- a/fs/namei.c +++ b/fs/namei.c @@ -268,8 +268,6 @@ int permission(struct inode *inode, int mask, struct nameidata *nd) if (nd) { if (nd->flags & LOOKUP_ACCESS) extra |= MAY_ACCESS; - if (nd->flags & LOOKUP_CHDIR) - extra |= MAY_CHDIR; if (nd->flags & LOOKUP_OPEN) extra |= MAY_OPEN; } diff --git a/fs/open.c b/fs/open.c index b2e4c93aed03..8e02d42bfe44 100644 --- a/fs/open.c +++ b/fs/open.c @@ -501,12 +501,11 @@ asmlinkage long sys_chdir(const char __user * filename) struct nameidata nd; int error; - error = __user_walk(filename, - LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd); + error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd); if (error) goto out; - error = vfs_permission(&nd, MAY_EXEC); + error = vfs_permission(&nd, MAY_EXEC | MAY_CHDIR); if (error) goto dput_and_out; |