f2fs: check lower bound nid value in check_nid_range
This patch add lower bound verification for nid in check_nid_range, so nids reserved like 0, node, meta passed by caller could be checked there. And then check_nid_range could be used in f2fs_nfs_get_inode for simplifying code. Signed-off-by: Chao Yu <chao2.yu@samsung.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
This commit is contained in:
@@ -689,9 +689,7 @@ static struct inode *f2fs_nfs_get_inode(struct super_block *sb,
|
||||
struct f2fs_sb_info *sbi = F2FS_SB(sb);
|
||||
struct inode *inode;
|
||||
|
||||
if (unlikely(ino < F2FS_ROOT_INO(sbi)))
|
||||
return ERR_PTR(-ESTALE);
|
||||
if (unlikely(ino >= NM_I(sbi)->max_nid))
|
||||
if (check_nid_range(sbi, ino))
|
||||
return ERR_PTR(-ESTALE);
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user