All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] f2fs: fix to put root inode in error path of fill_super
@ 2014-07-25  4:55 ` Chao Yu
  0 siblings, 0 replies; 4+ messages in thread
From: Chao Yu @ 2014-07-25  4:55 UTC (permalink / raw)
  To: Jaegeuk Kim, Changman Lee; +Cc: linux-kernel, linux-f2fs-devel

We should put root inode correctly in error path of fill_super, otherwise we
may encounter a leak case of inode resource.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
---
 fs/f2fs/super.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 870fe19..34649aa 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -1033,8 +1033,9 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
 		goto free_node_inode;
 	}
 	if (!S_ISDIR(root->i_mode) || !root->i_blocks || !root->i_size) {
+		iput(root);
 		err = -EINVAL;
-		goto free_root_inode;
+		goto free_node_inode;
 	}
 
 	sb->s_root = d_make_root(root); /* allocate root dentry */
-- 
2.0.1.474.g72c7794



------------------------------------------------------------------------------
Want fast and easy access to all the code in your enterprise? Index and
search up to 200,000 lines of code with a free copy of Black Duck
Code Sight - the same software that powers the world's largest code
search on Ohloh, the Black Duck Open Hub! Try it now.
http://p.sf.net/sfu/bds

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2014-07-25  6:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-25  4:55 [PATCH 2/2] f2fs: fix to put root inode in error path of fill_super Chao Yu
2014-07-25  4:55 ` [f2fs-dev][PATCH " Chao Yu
2014-07-25  5:58 ` [PATCH " Gu Zheng
2014-07-25  5:58   ` [f2fs-dev][PATCH " Gu Zheng

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.