* [PATCH] FUSE: multiple links to directory fix
@ 2005-04-28 14:16 Miklos Szeredi
0 siblings, 0 replies; only message in thread
From: Miklos Szeredi @ 2005-04-28 14:16 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
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);
}
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2005-04-28 14:16 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-04-28 14:16 [PATCH] FUSE: multiple links to directory fix Miklos Szeredi
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).