Skip to contentSkip to conversation

xfs: validate inumber in xfs_iget

PATCH In review Darrick J. Wong 3 participants 3 messages Jul 11, 2024 XFS filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 xfs: validate inumber in xfs_iget

From: Darrick J. Wong <[email protected]>

Actually use the inumber validator to check the argument passed in here.

---
 fs/xfs/xfs_icache.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
fs/xfs/xfs_icache.c +1 -1
index 9967334ea99f1..42a1d2e8cd56f 100644
@@ -754,7 +754,7 @@ xfs_iget(
 	ASSERT((lock_flags & (XFS_IOLOCK_EXCL | XFS_IOLOCK_SHARED)) == 0);
 
 	/* reject inode numbers outside existing AGs */
-	if (!ino || XFS_INO_TO_AGNO(mp, ino) >= mp->m_sb.sb_agcount)
+	if (!xfs_verify_ino(mp, ino))
 		return -EINVAL;
 
 	XFS_STATS_INC(mp, xs_ig_attempts);