Messages in this thread Patch in this message | ![/](/images/icornerl.gif) | | Subject | [PATCH] FUSE: multiple links to directory fix | From | Miklos Szeredi <> | Date | Thu, 28 Apr 2005 16:16:30 +0200 |
| |
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 <miklos@szeredi.hu>
diff -rup linux-2.6.12-rc2-mm3/fs/fuse/dir.c linux-fuse/fs/fuse/dir.c --- linux-2.6.12-rc2-mm3/fs/fuse/dir.c 2005-04-22 16:00:16.000000000 +0200 +++ linux-fuse/fs/fuse/dir.c 2005-04-28 15:32:02.000000000 +0200 @@ -703,6 +731,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); } - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| ![\](/images/icornerr.gif) |