diff options
-rw-r--r-- | fs/namei.c | 15 | ||||
-rw-r--r-- | include/linux/fs.h | 3 |
2 files changed, 13 insertions, 5 deletions
diff --git a/fs/namei.c b/fs/namei.c index ddb6a7c2b3d4..1180f9c58093 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1129,9 +1129,18 @@ static int follow_automount(struct path *path, struct nameidata *nd, | |||
1129 | * of the daemon to instantiate them before they can be used. | 1129 | * of the daemon to instantiate them before they can be used. |
1130 | */ | 1130 | */ |
1131 | if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | | 1131 | if (!(nd->flags & (LOOKUP_PARENT | LOOKUP_DIRECTORY | |
1132 | LOOKUP_OPEN | LOOKUP_CREATE | LOOKUP_AUTOMOUNT)) && | 1132 | LOOKUP_OPEN | LOOKUP_CREATE | |
1133 | path->dentry->d_inode) | 1133 | LOOKUP_AUTOMOUNT))) { |
1134 | return -EISDIR; | 1134 | /* Positive dentry that isn't meant to trigger an |
1135 | * automount, EISDIR will allow it to be used, | ||
1136 | * otherwise there's no mount here "now" so return | ||
1137 | * ENOENT. | ||
1138 | */ | ||
1139 | if (path->dentry->d_inode) | ||
1140 | return -EISDIR; | ||
1141 | else | ||
1142 | return -ENOENT; | ||
1143 | } | ||
1135 | 1144 | ||
1136 | if (path->dentry->d_sb->s_user_ns != &init_user_ns) | 1145 | if (path->dentry->d_sb->s_user_ns != &init_user_ns) |
1137 | return -EACCES; | 1146 | return -EACCES; |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 6111976848ff..2d0e6748e46e 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -3043,8 +3043,7 @@ static inline int vfs_lstat(const char __user *name, struct kstat *stat) | |||
3043 | static inline int vfs_fstatat(int dfd, const char __user *filename, | 3043 | static inline int vfs_fstatat(int dfd, const char __user *filename, |
3044 | struct kstat *stat, int flags) | 3044 | struct kstat *stat, int flags) |
3045 | { | 3045 | { |
3046 | return vfs_statx(dfd, filename, flags | AT_NO_AUTOMOUNT, | 3046 | return vfs_statx(dfd, filename, flags, stat, STATX_BASIC_STATS); |
3047 | stat, STATX_BASIC_STATS); | ||
3048 | } | 3047 | } |
3049 | static inline int vfs_fstat(int fd, struct kstat *stat) | 3048 | static inline int vfs_fstat(int fd, struct kstat *stat) |
3050 | { | 3049 | { |