Skip to content

Commit

Permalink
f2fs: free meta pages if sanity check for ckpt is failed
Browse files Browse the repository at this point in the history
This fixes missing freeing meta pages in the error case.

Signed-off-by: Jaegeuk Kim <[email protected]>
  • Loading branch information
Jaegeuk Kim committed Dec 6, 2016
1 parent e686849 commit 8af4734
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion fs/f2fs/checkpoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,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;
Expand Down Expand Up @@ -794,6 +794,9 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
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;
Expand Down

0 comments on commit 8af4734

Please sign in to comment.