Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2c605dd1 authored by Jaegeuk Kim's avatar Jaegeuk Kim Committed by Greg Kroah-Hartman
Browse files

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: 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>
parent b10a6ac2
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -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 @@ 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;