Commit 650a898342b3fa21c392c06a2b7010fa19823efa

Authored by Miklos Szeredi
Committed by Linus Torvalds
1 parent 5b35e8e58a

[PATCH] vfs: define new lookup flag for chdir

In the "operation does permission checking" model used by fuse, chdir
permission is not checked, since there's no chdir method.

For this case set a lookup flag, which will be passed to ->permission(), so
fuse can distinguish it from permission checks for other operations.

Signed-off-by: Miklos Szeredi <miklos@szeredi.hu>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 3 changed files with 4 additions and 2 deletions Side-by-side Diff

... ... @@ -776,7 +776,7 @@
776 776 if ((mask & MAY_EXEC) && !S_ISDIR(mode) && !(mode & S_IXUGO))
777 777 return -EACCES;
778 778  
779   - if (nd && (nd->flags & LOOKUP_ACCESS))
  779 + if (nd && (nd->flags & (LOOKUP_ACCESS | LOOKUP_CHDIR)))
780 780 return fuse_access(inode, mask);
781 781 return 0;
782 782 }
... ... @@ -546,7 +546,8 @@
546 546 struct nameidata nd;
547 547 int error;
548 548  
549   - error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
  549 + error = __user_walk(filename,
  550 + LOOKUP_FOLLOW|LOOKUP_DIRECTORY|LOOKUP_CHDIR, &nd);
550 551 if (error)
551 552 goto out;
552 553  
include/linux/namei.h
... ... @@ -54,6 +54,7 @@
54 54 #define LOOKUP_OPEN (0x0100)
55 55 #define LOOKUP_CREATE (0x0200)
56 56 #define LOOKUP_ACCESS (0x0400)
  57 +#define LOOKUP_CHDIR (0x0800)
57 58  
58 59 extern int FASTCALL(__user_walk(const char __user *, unsigned, struct nameidata *));
59 60 extern int FASTCALL(__user_walk_fd(int dfd, const char __user *, unsigned, struct nameidata *));