f2fs: free meta pages if sanity check for ckpt is failed
This fixes missing freeing meta pages in the error case. Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
parent
96e6c6084b
commit
640bdae24f
1 changed files with 4 additions and 1 deletions
|
@ -768,7 +768,7 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
|
||||||
|
|
||||||
/* Sanity checking of checkpoint */
|
/* Sanity checking of checkpoint */
|
||||||
if (sanity_check_ckpt(sbi))
|
if (sanity_check_ckpt(sbi))
|
||||||
goto fail_no_cp;
|
goto free_fail_no_cp;
|
||||||
|
|
||||||
if (cur_page == cp1)
|
if (cur_page == cp1)
|
||||||
sbi->cur_cp_pack = 1;
|
sbi->cur_cp_pack = 1;
|
||||||
|
@ -796,6 +796,9 @@ done:
|
||||||
f2fs_put_page(cp2, 1);
|
f2fs_put_page(cp2, 1);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
free_fail_no_cp:
|
||||||
|
f2fs_put_page(cp1, 1);
|
||||||
|
f2fs_put_page(cp2, 1);
|
||||||
fail_no_cp:
|
fail_no_cp:
|
||||||
kfree(sbi->ckpt);
|
kfree(sbi->ckpt);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
Loading…
Add table
Reference in a new issue