diff options
author | Ben Hutchings <ben.hutchings@codethink.co.uk> | 2018-11-29 19:17:34 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-12-05 19:41:15 +0100 |
commit | 2598fc56ed65f69e303ccee6d5fe756a56f87779 (patch) | |
tree | a729a83bb53ced5d28d41b3882b6b5eabbdc7d1a /fs/f2fs | |
parent | f3d6361a96a455c8ba12226a04efa67a0ada4966 (diff) | |
download | linux-stable-2598fc56ed65f69e303ccee6d5fe756a56f87779.tar.gz linux-stable-2598fc56ed65f69e303ccee6d5fe756a56f87779.tar.bz2 linux-stable-2598fc56ed65f69e303ccee6d5fe756a56f87779.zip |
f2fs: Add sanity_check_inode() function
This was done as part of commit 5d64600d4f33 "f2fs: avoid bug_on on
corrupted inode" upstream, but the specific check that commit added is
not applicable to 4.14.
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: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/inode.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/f2fs/inode.c b/fs/f2fs/inode.c index b1c0eb433841..917a6c3d5649 100644 --- a/fs/f2fs/inode.c +++ b/fs/f2fs/inode.c @@ -180,6 +180,13 @@ void f2fs_inode_chksum_set(struct f2fs_sb_info *sbi, struct page *page) ri->i_inode_checksum = cpu_to_le32(f2fs_inode_chksum(sbi, page)); } +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); @@ -281,6 +288,10 @@ struct inode *f2fs_iget(struct super_block *sb, unsigned long ino) ret = do_read_inode(inode); if (ret) goto bad_inode; + if (!sanity_check_inode(inode)) { + ret = -EINVAL; + goto bad_inode; + } make_now: if (ino == F2FS_NODE_INO(sbi)) { inode->i_mapping->a_ops = &f2fs_node_aops; |