From: Jaegeuk Kim Date: Tue, 6 Dec 2016 01:25:32 +0000 (-0800) Subject: f2fs: free meta pages if sanity check for ckpt is failed X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=2c605dd1ad233dc793e24f7074a5e0ad8a06337b;p=GitHub%2FLineageOS%2FG12%2Fandroid_kernel_amlogic_linux-4.9.git f2fs: free meta pages if sanity check for ckpt is failed commit a2125ff7dd1ed3a2a53cdc1f8f9c9cec9cfaa7ab upstream. This fixes missing freeing meta pages in the error case. Tested-by: Eric Biggers Signed-off-by: Jaegeuk Kim Signed-off-by: Ben Hutchings Signed-off-by: Greg Kroah-Hartman --- diff --git a/fs/f2fs/checkpoint.c b/fs/f2fs/checkpoint.c index 3f58f3a2766d..a57b7b10d13d 100644 --- a/fs/f2fs/checkpoint.c +++ b/fs/f2fs/checkpoint.c @@ -796,7 +796,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; @@ -824,6 +824,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;