This is a note to let you know that I've just added the patch titled f2fs: fix to do sanity check on extent cache correctly to the 6.1-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: f2fs-fix-to-do-sanity-check-on-extent-cache-correctly.patch and it can be found in the queue-6.1 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From d48a7b3a72f121655d95b5157c32c7d555e44c05 Mon Sep 17 00:00:00 2001 From: Chao Yu <chao@xxxxxxxxxx> Date: Mon, 9 Jan 2023 11:49:20 +0800 Subject: f2fs: fix to do sanity check on extent cache correctly From: Chao Yu <chao@xxxxxxxxxx> commit d48a7b3a72f121655d95b5157c32c7d555e44c05 upstream. In do_read_inode(), sanity_check_inode() should be called after f2fs_init_read_extent_tree(), fix it. Fixes: 72840cccc0a1 ("f2fs: allocate the extent_cache by default") Signed-off-by: Chao Yu <chao@xxxxxxxxxx> Signed-off-by: Jaegeuk Kim <jaegeuk@xxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- fs/f2fs/inode.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -413,12 +413,6 @@ static int do_read_inode(struct inode *i fi->i_inline_xattr_size = 0; } - if (!sanity_check_inode(inode, node_page)) { - f2fs_put_page(node_page, 1); - f2fs_handle_error(sbi, ERROR_CORRUPTED_INODE); - return -EFSCORRUPTED; - } - /* check data exist */ if (f2fs_has_inline_data(inode) && !f2fs_exist_data(inode)) __recover_inline_status(inode, node_page); @@ -481,6 +475,12 @@ static int do_read_inode(struct inode *i /* Need all the flag bits */ f2fs_init_read_extent_tree(inode, node_page); + if (!sanity_check_inode(inode, node_page)) { + f2fs_put_page(node_page, 1); + f2fs_handle_error(sbi, ERROR_CORRUPTED_INODE); + return -EFSCORRUPTED; + } + f2fs_put_page(node_page, 1); stat_inc_inline_xattr(inode); Patches currently in stable-queue which might be from chao@xxxxxxxxxx are queue-6.1/f2fs-specify-extent-cache-for-read-explicitly.patch queue-6.1/f2fs-inode-fix-to-do-sanity-check-on-extent-cache-correctly.patch queue-6.1/f2fs-factor-out-victim_entry-usage-from-general-rb_t.patch queue-6.1/f2fs-refactor-extent_cache-to-support-for-read-and-m.patch queue-6.1/f2fs-move-internal-functions-into-extent_cache.c.patch queue-6.1/f2fs-fix-null-pointer-panic-in-tracepoint-in-__replace_atomic_write_block.patch queue-6.1/f2fs-fix-to-do-sanity-check-on-extent-cache-correctly.patch queue-6.1/f2fs-remove-unnecessary-__init_extent_tree.patch