]> www.infradead.org Git - users/hch/xfsprogs.git/commitdiff
FOLD: xfs: move inode number validation to xfs_meta_iget
authorChristoph Hellwig <hch@lst.de>
Fri, 12 Apr 2024 05:12:15 +0000 (07:12 +0200)
committerChristoph Hellwig <hch@lst.de>
Fri, 12 Apr 2024 06:00:43 +0000 (08:00 +0200)
libxfs/inode.c

index feba8026eb521944af29b65d874f2e9a57ff5336..61840db7285ca8b2a6f28e812fbe25b856ec78a3 100644 (file)
@@ -28,6 +28,7 @@
 #include "xfs_da_format.h"
 #include "xfs_da_btree.h"
 #include "xfs_dir2_priv.h"
+#include "xfs_health.h"
 
 /*
  * Initialise a newly allocated inode and return the in-core inode to the
@@ -240,6 +241,11 @@ libxfs_imeta_iget(
        struct xfs_inode        *ip;
        int                     error;
 
+       if (!libxfs_verify_ino(mp, ino)) {
+               xfs_fs_mark_sick(mp, XFS_SICK_FS_METADIR);
+               return -EFSCORRUPTED;
+       }
+
        error = libxfs_iget(mp, tp, ino, XFS_IGET_UNTRUSTED, &ip);
        if (error)
                return error;