diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2016-06-05 00:23:09 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2016-06-05 00:23:09 -0400 |
commit | e6ec03a25f12b312b7e0c037fe4a6471c4ee5665 (patch) | |
tree | d39790d5a1e2a78fbd76b0ea6082f1a8016fc195 | |
parent | fac7d1917dfddfa53e98524f0abfbe60252740fe (diff) |
autofs braino fix for do_last()
It's an analogue of commit 7500c38a (fix the braino in "namei:
massage lookup_slow() to be usable by lookup_one_len_unlocked()").
The same problem (->lookup()-returned unhashed negative dentry
just might be an autofs one with ->d_manage() that would wait
until the daemon makes it positive) applies in do_last() - we
need to do follow_managed() first.
Fortunately, remaining callers of follow_managed() are OK - only
autofs has that weirdness (negative dentry that does not mean
an instant -ENOENT)) and autofs never has its negative dentries
hashed, so we can't pick one from a dcache lookup.
->d_manage() is a bloody mess ;-/
Cc: stable@vger.kernel.org # v4.6
Spotted-by: Ian Kent <raven@themaw.net>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r-- | fs/namei.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/fs/namei.c b/fs/namei.c index 3d9511e656ab..d7c0cac56d89 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -3260,6 +3260,10 @@ static int do_last(struct nameidata *nd, | |||
3260 | got_write = false; | 3260 | got_write = false; |
3261 | } | 3261 | } |
3262 | 3262 | ||
3263 | error = follow_managed(&path, nd); | ||
3264 | if (unlikely(error < 0)) | ||
3265 | return error; | ||
3266 | |||
3263 | if (unlikely(d_is_negative(path.dentry))) { | 3267 | if (unlikely(d_is_negative(path.dentry))) { |
3264 | path_to_nameidata(&path, nd); | 3268 | path_to_nameidata(&path, nd); |
3265 | return -ENOENT; | 3269 | return -ENOENT; |
@@ -3275,10 +3279,6 @@ static int do_last(struct nameidata *nd, | |||
3275 | return -EEXIST; | 3279 | return -EEXIST; |
3276 | } | 3280 | } |
3277 | 3281 | ||
3278 | error = follow_managed(&path, nd); | ||
3279 | if (unlikely(error < 0)) | ||
3280 | return error; | ||
3281 | |||
3282 | seq = 0; /* out of RCU mode, so the value doesn't matter */ | 3282 | seq = 0; /* out of RCU mode, so the value doesn't matter */ |
3283 | inode = d_backing_inode(path.dentry); | 3283 | inode = d_backing_inode(path.dentry); |
3284 | finish_lookup: | 3284 | finish_lookup: |