diff options
-rw-r--r-- | fs/namei.c | 2 | ||||
-rw-r--r-- | fs/open.c | 5 | ||||
-rw-r--r-- | include/linux/namei.h | 1 |
3 files changed, 2 insertions, 6 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) | |||
268 | if (nd) { | 268 | if (nd) { |
269 | if (nd->flags & LOOKUP_ACCESS) | 269 | if (nd->flags & LOOKUP_ACCESS) |
270 | extra |= MAY_ACCESS; | 270 | extra |= MAY_ACCESS; |
271 | if (nd->flags & LOOKUP_CHDIR) | ||
272 | extra |= MAY_CHDIR; | ||
273 | if (nd->flags & LOOKUP_OPEN) | 271 | if (nd->flags & LOOKUP_OPEN) |
274 | extra |= MAY_OPEN; | 272 | extra |= MAY_OPEN; |
275 | } | 273 | } |
@@ -501,12 +501,11 @@ asmlinkage long sys_chdir(const char __user * filename) | |||
501 | struct nameidata nd; | 501 | struct nameidata nd; |
502 | int error; | 502 | int error; |
503 | 503 | ||
504 | error = __user_walk(filename, | 504 | error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd); |
505 | LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd); | ||
506 | if (error) | 505 | if (error) |
507 | goto out; | 506 | goto out; |
508 | 507 | ||
509 | error = vfs_permission(&nd, MAY_EXEC); | 508 | error = vfs_permission(&nd, MAY_EXEC | MAY_CHDIR); |
510 | if (error) | 509 | if (error) |
511 | goto dput_and_out; | 510 | goto dput_and_out; |
512 | 511 | ||
diff --git a/include/linux/namei.h b/include/linux/namei.h index 24d88e98a626..3cf62d26d493 100644 --- a/include/linux/namei.h +++ b/include/linux/namei.h | |||
@@ -55,7 +55,6 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND}; | |||
55 | #define LOOKUP_OPEN (0x0100) | 55 | #define LOOKUP_OPEN (0x0100) |
56 | #define LOOKUP_CREATE (0x0200) | 56 | #define LOOKUP_CREATE (0x0200) |
57 | #define LOOKUP_ACCESS (0x0400) | 57 | #define LOOKUP_ACCESS (0x0400) |
58 | #define LOOKUP_CHDIR (0x0800) | ||
59 | 58 | ||
60 | extern int __user_walk(const char __user *, unsigned, struct nameidata *); | 59 | extern int __user_walk(const char __user *, unsigned, struct nameidata *); |
61 | extern int __user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *); | 60 | extern int __user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *); |