]> www.infradead.org Git - users/hch/xfs.git/commitdiff
xfs: validate inumber in xfs_iget
authorDarrick J. Wong <djwong@kernel.org>
Tue, 9 Jul 2024 14:17:56 +0000 (07:17 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Wed, 31 Jul 2024 01:52:44 +0000 (18:52 -0700)
Actually use the inumber validator to check the argument passed in here.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
fs/xfs/xfs_icache.c

index 9967334ea99f1a77b3d58b5d061c1b8b539f163d..42a1d2e8cd56fddbc49b29443b24befc93ffabab 100644 (file)
@@ -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);