Commit 3ddda932 authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Stefan Bader

f2fs: free meta pages if sanity check for ckpt is failed

BugLink: https://bugs.launchpad.net/bugs/1818797

commit a2125ff7 upstream.

This fixes missing freeing meta pages in the error case.
Tested-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: default avatarBen Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent b613859d
...@@ -708,7 +708,7 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi) ...@@ -708,7 +708,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;
...@@ -736,6 +736,9 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi) ...@@ -736,6 +736,9 @@ int get_valid_checkpoint(struct f2fs_sb_info *sbi)
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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment