From: "J. Bruce Fields" <bfields@redhat.com>
To: Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>,
linux-fsdevel@vger.kernel.org,
"J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 11/11] dcache: d_splice_alias should detect loops
Date: Wed, 4 Jun 2014 17:21:03 -0400 [thread overview]
Message-ID: <1401916863-7916-12-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <1401916863-7916-1-git-send-email-bfields@redhat.com>
From: "J. Bruce Fields" <bfields@redhat.com>
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>
---
fs/dcache.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/fs/dcache.c b/fs/dcache.c
index 960a2e7..f6ab71b 100644
--- a/fs/dcache.c
+++ b/fs/dcache.c
@@ -2643,6 +2643,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);
--
1.7.9.5
prev parent reply other threads:[~2014-06-04 21:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-04 21:20 [PATCH 00/11] mainly d_splice_alias fixes J. Bruce Fields
2014-06-04 21:20 ` [PATCH 01/11] namei: trivial fix to vfs_rename_dir comment J. Bruce Fields
2014-06-04 21:20 ` [PATCH 02/11] dcache: move d_splice_alias J. Bruce Fields
2014-06-04 21:20 ` [PATCH 03/11] dcache: close d_move race in d_splice_alias J. Bruce Fields
2014-06-04 21:20 ` [PATCH 04/11] dcache: d_splice_alias mustn't create directory aliases J. Bruce Fields
2014-06-04 21:20 ` [PATCH 05/11] dcache: d_splice_alias should ignore DCACHE_DISCONNECTED J. Bruce Fields
2014-06-04 21:20 ` [PATCH 06/11] dcache: d_obtain_alias callers don't all want DISCONNECTED J. Bruce Fields
2014-06-04 21:20 ` [PATCH 07/11] dcache: remove unused d_find_alias parameter J. Bruce Fields
2014-06-04 21:21 ` [PATCH 08/11] dcache: d_find_alias needn't recheck IS_ROOT && DCACHE_DISCONNECTED J. Bruce Fields
2014-06-04 21:21 ` [PATCH 09/11] exportfs: update Exporting documentation J. Bruce Fields
2014-06-04 21:54 ` Bernd Schubert
2014-06-06 21:23 ` J. Bruce Fields
2014-06-05 12:51 ` Marc Dionne
2014-06-06 21:20 ` J. Bruce Fields
2014-06-04 21:21 ` [PATCH 10/11] dcache: d_materialise_unique isn't GPL-only J. Bruce Fields
2014-06-04 21:21 ` J. Bruce Fields [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1401916863-7916-12-git-send-email-bfields@redhat.com \
--to=bfields@redhat.com \
--cc=hch@infradead.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).