From: Chao Yu Date: Wed, 12 Mar 2014 09:08:36 +0000 (+0800) Subject: f2fs: check upper bound of ino value in f2fs_nfs_get_inode X-Git-Tag: firefly_0821_release~176^2~4116^2~27 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=910bb12d29cc64144506333bfeaeeee9715c3872;p=firefly-linux-kernel-4.4.55.git f2fs: check upper bound of ino value in f2fs_nfs_get_inode Upper bound checking of ino should be added to f2fs_nfs_get_inode, so unneeded process before do_read_inode in f2fs_iget could be avoided when ino is invalid. Signed-off-by: Chao Yu Signed-off-by: Jaegeuk Kim --- diff --git a/fs/f2fs/super.c b/fs/f2fs/super.c index 6e4851ce029b..3a51d7a4a6c9 100644 --- a/fs/f2fs/super.c +++ b/fs/f2fs/super.c @@ -644,6 +644,8 @@ static struct inode *f2fs_nfs_get_inode(struct super_block *sb, if (unlikely(ino < F2FS_ROOT_INO(sbi))) return ERR_PTR(-ESTALE); + if (unlikely(ino >= NM_I(sbi)->max_nid)) + return ERR_PTR(-ESTALE); /* * f2fs_iget isn't quite right if the inode is currently unallocated!