From 6b9cceead0d1fc478fbc25a7d8d8f006d061a1a2 Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 30 Apr 2018 19:51:43 -0400 Subject: hfs: use d_splice_alias() code is simpler that way Signed-off-by: Al Viro --- fs/hfs/inode.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'fs/hfs/inode.c') diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 2538b49cc349..0612fa367bd1 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -544,8 +544,7 @@ static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry, hlist_add_fake(&inode->i_hash); mark_inode_dirty(inode); out: - d_add(dentry, inode); - return NULL; + return d_splice_alias(inode, dentry); } void hfs_evict_inode(struct inode *inode) -- cgit v1.2.3 From 0e5c56fd07432c426b7ab1a84e8d97a00d7e08ca Mon Sep 17 00:00:00 2001 From: Al Viro Date: Mon, 30 Apr 2018 19:52:18 -0400 Subject: hfs: don't allow mounting over .../rsrc That's one case when unlink() destroys a subtree, thanks to "resource fork" idiocy. We might forcibly evict that shit on unlink(2), but for now let's just disallow overmounting; as it is, anything that plays games with those would leak mounts. Signed-off-by: Al Viro --- fs/hfs/inode.c | 1 + 1 file changed, 1 insertion(+) (limited to 'fs/hfs/inode.c') diff --git a/fs/hfs/inode.c b/fs/hfs/inode.c index 0612fa367bd1..b3309b83371a 100644 --- a/fs/hfs/inode.c +++ b/fs/hfs/inode.c @@ -543,6 +543,7 @@ static struct dentry *hfs_file_lookup(struct inode *dir, struct dentry *dentry, igrab(dir); hlist_add_fake(&inode->i_hash); mark_inode_dirty(inode); + dont_mount(dentry); out: return d_splice_alias(inode, dentry); } -- cgit v1.2.3