Skip to content

Commit a2125ff

Browse files
author
Jaegeuk Kim
committed
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 <[email protected]> Signed-off-by: Jaegeuk Kim <[email protected]>
1 parent 2040fce commit a2125ff

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

fs/f2fs/checkpoint.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
770770

771771
/* Sanity checking of checkpoint */
772772
if (sanity_check_ckpt(sbi))
773-
goto fail_no_cp;
773+
goto free_fail_no_cp;
774774

775775
if (cur_page == cp1)
776776
sbi->cur_cp_pack = 1;
@@ -798,6 +798,9 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
798798
f2fs_put_page(cp2, 1);
799799
return 0;
800800

801+
free_fail_no_cp:
802+
f2fs_put_page(cp1, 1);
803+
f2fs_put_page(cp2, 1);
801804
fail_no_cp:
802805
kfree(sbi->ckpt);
803806
return -EINVAL;

0 commit comments

Comments
 (0)