Skip to content

Commit

Permalink
dcache: d_splice_alias should detect loops
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
J. Bruce Fields authored and Al Viro committed Aug 7, 2014
1 parent 9635389 commit 95ad5c2
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions fs/dcache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 95ad5c2

Please sign in to comment.