public inbox for linux-xfs@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] xfs: validate inumber in xfs_iget
@ 2024-07-11  5:44 Darrick J. Wong
  2024-07-11  5:54 ` Christoph Hellwig
  2024-07-11 22:27 ` Dave Chinner
  0 siblings, 2 replies; 3+ messages in thread
From: Darrick J. Wong @ 2024-07-11  5:44 UTC (permalink / raw)
  To: Christoph Hellwig; +Cc: xfs

From: Darrick J. Wong <djwong@kernel.org>

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

Signed-off-by: Darrick J. Wong <djwong@kernel.org>
---
 fs/xfs/xfs_icache.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/fs/xfs/xfs_icache.c b/fs/xfs/xfs_icache.c
index 9967334ea99f1..42a1d2e8cd56f 100644
--- a/fs/xfs/xfs_icache.c
+++ b/fs/xfs/xfs_icache.c
@@ -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);

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: validate inumber in xfs_iget
  2024-07-11  5:44 [PATCH] xfs: validate inumber in xfs_iget Darrick J. Wong
@ 2024-07-11  5:54 ` Christoph Hellwig
  2024-07-11 22:27 ` Dave Chinner
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2024-07-11  5:54 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, xfs

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] xfs: validate inumber in xfs_iget
  2024-07-11  5:44 [PATCH] xfs: validate inumber in xfs_iget Darrick J. Wong
  2024-07-11  5:54 ` Christoph Hellwig
@ 2024-07-11 22:27 ` Dave Chinner
  1 sibling, 0 replies; 3+ messages in thread
From: Dave Chinner @ 2024-07-11 22:27 UTC (permalink / raw)
  To: Darrick J. Wong; +Cc: Christoph Hellwig, xfs

On Wed, Jul 10, 2024 at 10:44:30PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <djwong@kernel.org>
> 
> Actually use the inumber validator to check the argument passed in here.
> 
> Signed-off-by: Darrick J. Wong <djwong@kernel.org>

looks good.

Reviewed-by: Dave Chinner <dchinner@redhat.com>
-- 
Dave Chinner
david@fromorbit.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-11 22:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-11  5:44 [PATCH] xfs: validate inumber in xfs_iget Darrick J. Wong
2024-07-11  5:54 ` Christoph Hellwig
2024-07-11 22:27 ` Dave Chinner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox