diff options
Diffstat (limited to 'fs/namei.c')
-rw-r--r-- | fs/namei.c | 15 |
1 files changed, 12 insertions, 3 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; |