diff options
author | J. Bruce Fields | 2014-03-12 12:19:23 -0400 |
---|---|---|
committer | Al Viro | 2014-08-07 14:40:11 -0400 |
commit | 95ad5c291313b66a98a44dc92b57e0b37c1dd589 (patch) | |
tree | 280b21d80632acd09ae17b9eace58e321bda41fb /fs/dcache.c | |
parent | 9635389534a765c8357d988e53d323bf033dcdd0 (diff) |
dcache: d_splice_alias should detect loops
I believe this can only happen in the case of a corrupted filesystem.
So -EIO looks like the appropriate error.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/dcache.c')
-rw-r--r-- | fs/dcache.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/fs/dcache.c b/fs/dcache.c index 85a2aad3dcb3..ad137005cda7 100644 --- a/fs/dcache.c +++ b/fs/dcache.c @@ -2706,6 +2706,11 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) dput(new); return ERR_PTR(-EIO); } + if (d_ancestor(new, dentry)) { + spin_unlock(&inode->i_lock); + dput(new); + return ERR_PTR(-EIO); + } write_seqlock(&rename_lock); __d_materialise_dentry(dentry, new); write_sequnlock(&rename_lock); |