mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
vfs: check unlinked ancestors before mount
We check submounts before doing d_drop() on a non-empty directory dentry in NFS (have_submounts()), but we do not exclude a racing mount. Nor do we prevent mounts to be added to the disconnected subtree using relative paths after the d_drop(). This patch fixes these issues by checking for unlinked (unhashed, non-root) ancestors before proceeding with the mount. This is done with rename seqlock taken for write and with ->d_lock grabbed on each ancestor in turn, including our dentry itself. This ensures that the only one of check_submounts_and_drop() or has_unlinked_ancestor() can succeed. Signed-off-by: Miklos Szeredi <miklos@szeredi.hu> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
848ac114e8
commit
eed8100766
3 changed files with 39 additions and 6 deletions
|
@ -126,6 +126,7 @@ extern int invalidate_inodes(struct super_block *, bool);
|
|||
* dcache.c
|
||||
*/
|
||||
extern struct dentry *__d_alloc(struct super_block *, const struct qstr *);
|
||||
extern int d_set_mounted(struct dentry *dentry);
|
||||
|
||||
/*
|
||||
* read_write.c
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue