aboutsummaryrefslogtreecommitdiffstats
path: root/fs/f2fs
diff options
context:
space:
mode:
authorChao Yu <chao2.yu@samsung.com>2013-11-07 10:14:51 +0800
committerJaegeuk Kim <jaegeuk.kim@samsung.com>2013-11-08 14:10:29 +0900
commit1d15bd2034c9b0f9ac88fa0e4cd33e0d792b0bb0 (patch)
tree15ec30357bbfd5fe1af95e1f4a281b3dd3724d36 /fs/f2fs
parentf2fs: cleanup waiting routine for writeback pages in cp (diff)
downloadlinux-dev-1d15bd2034c9b0f9ac88fa0e4cd33e0d792b0bb0.tar.xz
linux-dev-1d15bd2034c9b0f9ac88fa0e4cd33e0d792b0bb0.zip
f2fs: fix memory leak after kobject init failed in fill_super
If we failed to init&add kobject when fill_super, stats info and proc object of f2fs will not be released. We should free them before we finish fill_super. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk.kim@samsung.com>
Diffstat (limited to 'fs/f2fs')
-rw-r--r--fs/f2fs/super.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c
index 00e79df5a34f..bafff72de8e8 100644
--- a/fs/f2fs/super.c
+++ b/fs/f2fs/super.c
@@ -975,12 +975,12 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
/* After POR, we can run background GC thread.*/
err = start_gc_thread(sbi);
if (err)
- goto fail;
+ goto free_gc;
}
err = f2fs_build_stats(sbi);
if (err)
- goto fail;
+ goto free_gc;
if (f2fs_proc_root)
sbi->s_proc = proc_mkdir(sb->s_id, f2fs_proc_root);
@@ -1006,6 +1006,12 @@ static int f2fs_fill_super(struct super_block *sb, void *data, int silent)
return 0;
fail:
+ if (sbi->s_proc) {
+ remove_proc_entry("segment_info", sbi->s_proc);
+ remove_proc_entry(sb->s_id, f2fs_proc_root);
+ }
+ f2fs_destroy_stats(sbi);
+free_gc:
stop_gc_thread(sbi);
free_root_inode:
dput(sb->s_root);