Skip to contentSkip to conversation

f2fs: check upper bound of ino value in f2fs_nfs_get_inode

PATCH New Chao Yu 1 participant 1 message Mar 12, 2014

Subsystems (2)
lore
Share & tools
lore

Chao Yu

author
#0 lore raw

PATCH 1/1 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.

---
 fs/f2fs/super.c |    2 ++
 1 file changed, 2 insertions(+)
fs/f2fs/super.c +2 -0
index 6e4851c..3a51d7a 100644
@@ -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!
Signature · 1 line
1.7.9.5