diff options
author | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-12-06 04:25:32 +0300 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2016-12-08 01:38:16 +0300 |
commit | a2125ff7dd1ed3a2a53cdc1f8f9c9cec9cfaa7ab (patch) | |
tree | 1c10f76afb80d448c0829e6172a789fff06feeec /fs/f2fs | |
parent | 2040fce83fe17763b07c97c1f691da2bb85e4135 (diff) | |
download | linux-a2125ff7dd1ed3a2a53cdc1f8f9c9cec9cfaa7ab.tar.xz |
f2fs: free meta pages if sanity check for ckpt is failed
This fixes missing freeing meta pages in the error case.
Tested-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/checkpoint.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 35601b0d077f..698b13ae261c 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -770,7 +770,7 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi) /* Sanity checking of checkpoint */ if (sanity_check_ckpt(sbi)) - goto fail_no_cp; + goto free_fail_no_cp; if (cur_page == cp1) sbi->cur_cp_pack = 1; @@ -798,6 +798,9 @@ done: f2fs_put_page(cp2, 1); return 0; +free_fail_no_cp: + f2fs_put_page(cp1, 1); + f2fs_put_page(cp2, 1); fail_no_cp: kfree(sbi->ckpt); return -EINVAL; |