From: Miklos Szeredi This patch fixes a bug, that allowed multiple dentries to refer to the same directory inode. This check was dropped from the 2.6 version probably because I believed that d_splice_alias() will somehow do this check (which it doesn't). Thanks to the fine folks on linux-fsdevel reminding me of the ugly possibility of hardlinked directories. Signed-off-by: Miklos Szeredi Signed-off-by: Andrew Morton --- fs/fuse/dir.c | 9 +++++++++ 1 files changed, 9 insertions(+) diff -puN fs/fuse/dir.c~fuse-read-only-operations-multiple-links-to-directory-fix fs/fuse/dir.c --- 25/fs/fuse/dir.c~fuse-read-only-operations-multiple-links-to-directory-fix Thu Apr 28 16:53:22 2005 +++ 25-akpm/fs/fuse/dir.c Thu Apr 28 16:53:22 2005 @@ -359,6 +359,15 @@ static struct dentry *fuse_lookup(struct int err = fuse_lookup_iget(dir, entry, &inode); if (err) return ERR_PTR(err); + if (inode && S_ISDIR(inode->i_mode)) { + /* Don't allow creating an alias to a directory */ + struct dentry *alias = d_find_alias(inode); + if (alias && !(alias->d_flags & DCACHE_DISCONNECTED)) { + dput(alias); + iput(inode); + return ERR_PTR(-EIO); + } + } return d_splice_alias(inode, entry); } _