]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
libxfs: validate inumber in xfs_iget
authorDarrick J. Wong <djwong@kernel.org>
Tue, 29 Oct 2024 00:03:30 +0000 (17:03 -0700)
committerDarrick J. Wong <djwong@kernel.org>
Thu, 31 Oct 2024 22:45:04 +0000 (15:45 -0700)
Actually use the inumber validator to check the argument passed in here,
just like we now do in the kernel.

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
libxfs/inode.c

index 2062ecf54486cffcbd84818b0faeee53f26500b4..9230ad24a5cb6c00a7773b8c53f10ad9527e827b 100644 (file)
@@ -143,7 +143,7 @@ libxfs_iget(
        int                     error = 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;
 
        ip = kmem_cache_zalloc(xfs_inode_cache, 0);