diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2018-11-29 22:17:34 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-01-26 11:42:48 +0300 |
commit | 24f8bb89456419da6a5907b262afd1d0934c3bc9 (patch) | |
tree | 80e37a47afdd0cadf88fab04acaf04bad6a60e31 /fs/f2fs | |
parent | b31ccde086671b372957e1fe1c60968e6d7464d7 (diff) | |
download | linux-24f8bb89456419da6a5907b262afd1d0934c3bc9.tar.xz |
f2fs: Add sanity_check_inode() function
This was done as part of commits 5d64600d4f33 "f2fs: avoid bug_on on
corrupted inode" and 76d56d4ab4f2 "f2fs: fix to do sanity check with
extra_attr feature" upstream, but the specific checks they added are
not applicable to 4.4.
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Cc: Chao Yu <yuchao0@huawei.com>
Signed-off-by: Ben Hutchings <ben.hutchings@codethink.co.uk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/inode.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index 702e9b637fc0..0f49638d2a5d 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -95,6 +95,13 @@ static void __recover_inline_status(struct inode *inode, struct page *ipage) return; } +static bool sanity_check_inode(struct inode *inode) +{ + struct f2fs_sb_info *sbi = F2FS_I_SB(inode); + + return true; +} + static int do_read_inode(struct inode *inode) { struct f2fs_sb_info *sbi = F2FS_I_SB(inode); @@ -143,6 +150,11 @@ static int do_read_inode(struct inode *inode) get_inline_info(fi, ri); + if (!sanity_check_inode(inode)) { + f2fs_put_page(node_page, 1); + return -EINVAL; + } + /* check data exist */ if (f2fs_has_inline_data(inode) && !f2fs_exist_data(inode)) __recover_inline_status(inode, node_page); |