From a828f4fd083ce2be04152fc4752292ff2bb89325 Mon Sep 17 00:00:00 2001 From: Alexander Viro Date: Wed, 3 Mar 2004 21:23:25 -0800 Subject: [PATCH] [PATCH] d_alloc_root() fixes: hfsplus - inode leak on d_alloc_root() failure --- fs/hfsplus/super.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fs/hfsplus/super.c b/fs/hfsplus/super.c index 3040a75bb781f..16e6dd8ca896f 100644 --- a/fs/hfsplus/super.c +++ b/fs/hfsplus/super.c @@ -278,6 +278,7 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) struct hfsplus_sb_info *sbi; hfsplus_cat_entry entry; struct hfs_find_data fd; + struct inode *root; struct qstr str; int err = -EINVAL; @@ -364,10 +365,12 @@ static int hfsplus_fill_super(struct super_block *sb, void *data, int silent) } /* Load the root directory */ - sb->s_root = d_alloc_root(iget(sb, HFSPLUS_ROOT_CNID)); + root = iget(sb, HFSPLUS_ROOT_CNID); + sb->s_root = d_alloc_root(root); if (!sb->s_root) { if (!silent) printk("HFS+-fs: failed to load root directory\n"); + iput(root); goto cleanup; } -- 2.53.0