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>
This commit is contained in:
parent
fac7d1917d
commit
e6ec03a25f
@ -3260,6 +3260,10 @@ static int do_last(struct nameidata *nd,
|
|||||||
got_write = false;
|
got_write = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
error = follow_managed(&path, nd);
|
||||||
|
if (unlikely(error < 0))
|
||||||
|
return error;
|
||||||
|
|
||||||
if (unlikely(d_is_negative(path.dentry))) {
|
if (unlikely(d_is_negative(path.dentry))) {
|
||||||
path_to_nameidata(&path, nd);
|
path_to_nameidata(&path, nd);
|
||||||
return -ENOENT;
|
return -ENOENT;
|
||||||
@ -3275,10 +3279,6 @@ static int do_last(struct nameidata *nd,
|
|||||||
return -EEXIST;
|
return -EEXIST;
|
||||||
}
|
}
|
||||||
|
|
||||||
error = follow_managed(&path, nd);
|
|
||||||
if (unlikely(error < 0))
|
|
||||||
return error;
|
|
||||||
|
|
||||||
seq = 0; /* out of RCU mode, so the value doesn't matter */
|
seq = 0; /* out of RCU mode, so the value doesn't matter */
|
||||||
inode = d_backing_inode(path.dentry);
|
inode = d_backing_inode(path.dentry);
|
||||||
finish_lookup:
|
finish_lookup:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user