aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/namei.c6
-rw-r--r--fs/stat.c4
-rw-r--r--include/linux/fcntl.h1
-rw-r--r--include/linux/namei.h2
4 files changed, 12 insertions, 1 deletions
diff --git a/fs/namei.c b/fs/namei.c
index 9d3033dc22e9..dc50bfb2f5d6 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -908,6 +908,12 @@ static int follow_automount(struct path *path, unsigned flags,
908 if (!path->dentry->d_op || !path->dentry->d_op->d_automount) 908 if (!path->dentry->d_op || !path->dentry->d_op->d_automount)
909 return -EREMOTE; 909 return -EREMOTE;
910 910
911 /* We don't want to mount if someone supplied AT_NO_AUTOMOUNT
912 * and this is the terminal part of the path.
913 */
914 if ((flags & LOOKUP_NO_AUTOMOUNT) && !(flags & LOOKUP_CONTINUE))
915 return -EISDIR; /* we actually want to stop here */
916
911 /* We want to mount if someone is trying to open/create a file of any 917 /* We want to mount if someone is trying to open/create a file of any
912 * type under the mountpoint, wants to traverse through the mountpoint 918 * type under the mountpoint, wants to traverse through the mountpoint
913 * or wants to open the mounted directory. 919 * or wants to open the mounted directory.
diff --git a/fs/stat.c b/fs/stat.c
index 12e90e213900..d5c61cf2b703 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -75,11 +75,13 @@ int vfs_fstatat(int dfd, const char __user *filename, struct kstat *stat,
75 int error = -EINVAL; 75 int error = -EINVAL;
76 int lookup_flags = 0; 76 int lookup_flags = 0;
77 77
78 if ((flag & ~AT_SYMLINK_NOFOLLOW) != 0) 78 if ((flag & ~(AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT)) != 0)
79 goto out; 79 goto out;
80 80
81 if (!(flag & AT_SYMLINK_NOFOLLOW)) 81 if (!(flag & AT_SYMLINK_NOFOLLOW))
82 lookup_flags |= LOOKUP_FOLLOW; 82 lookup_flags |= LOOKUP_FOLLOW;
83 if (flag & AT_NO_AUTOMOUNT)
84 lookup_flags |= LOOKUP_NO_AUTOMOUNT;
83 85
84 error = user_path_at(dfd, filename, lookup_flags, &path); 86 error = user_path_at(dfd, filename, lookup_flags, &path);
85 if (error) 87 if (error)
diff --git a/include/linux/fcntl.h b/include/linux/fcntl.h
index afc00af3229b..a562fa5fb4e3 100644
--- a/include/linux/fcntl.h
+++ b/include/linux/fcntl.h
@@ -45,6 +45,7 @@
45#define AT_REMOVEDIR 0x200 /* Remove directory instead of 45#define AT_REMOVEDIR 0x200 /* Remove directory instead of
46 unlinking file. */ 46 unlinking file. */
47#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */ 47#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
48#define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount traversal */
48 49
49#ifdef __KERNEL__ 50#ifdef __KERNEL__
50 51
diff --git a/include/linux/namei.h b/include/linux/namei.h
index 8ef2c789c2a8..f276d4fa01fc 100644
--- a/include/linux/namei.h
+++ b/include/linux/namei.h
@@ -45,6 +45,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
45 * - ending slashes ok even for nonexistent files 45 * - ending slashes ok even for nonexistent files
46 * - internal "there are more path components" flag 46 * - internal "there are more path components" flag
47 * - dentry cache is untrusted; force a real lookup 47 * - dentry cache is untrusted; force a real lookup
48 * - suppress terminal automount
48 */ 49 */
49#define LOOKUP_FOLLOW 0x0001 50#define LOOKUP_FOLLOW 0x0001
50#define LOOKUP_DIRECTORY 0x0002 51#define LOOKUP_DIRECTORY 0x0002
@@ -53,6 +54,7 @@ enum {LAST_NORM, LAST_ROOT, LAST_DOT, LAST_DOTDOT, LAST_BIND};
53#define LOOKUP_PARENT 0x0010 54#define LOOKUP_PARENT 0x0010
54#define LOOKUP_REVAL 0x0020 55#define LOOKUP_REVAL 0x0020
55#define LOOKUP_RCU 0x0040 56#define LOOKUP_RCU 0x0040
57#define LOOKUP_NO_AUTOMOUNT 0x0080
56/* 58/*
57 * Intent data 59 * Intent data
58 */ 60 */