]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
xfs: don't zap bmbt forks if they are MAXLEVELS tall
authorDarrick J. Wong <djwong@kernel.org>
Tue, 14 Jul 2026 06:07:30 +0000 (23:07 -0700)
committerCarlos Maiolino <cem@kernel.org>
Tue, 14 Jul 2026 09:01:47 +0000 (11:01 +0200)
LOLLM noticed a discrepancy between the bmbt level checks in the libxfs
bmbt code vs. the inode repair code.  We do actually allow a bmbt root
that proclaims to have a height of XFS_BM_MAXLEVELS.

Cc: stable@vger.kernel.org # v6.8
Fixes: e744cef2060559 ("xfs: zap broken inode forks")
Signed-off-by: "Darrick J. Wong" <djwong@kernel.org>
Assisted-by: LOLLM # finding obvious bugs
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/scrub/inode_repair.c

index 5565e80691a69e672eaf4b8717c83249c18db4a2..3ec41c19835116201112a0db2e8ed294c316f3fa 100644 (file)
@@ -921,7 +921,7 @@ xrep_dinode_bad_bmbt_fork(
 
        if (nrecs == 0 || xfs_bmdr_space_calc(nrecs) > dfork_size)
                return true;
-       if (level == 0 || level >= XFS_BM_MAXLEVELS(sc->mp, whichfork))
+       if (level == 0 || level > XFS_BM_MAXLEVELS(sc->mp, whichfork))
                return true;
 
        dmxr = xfs_bmdr_maxrecs(dfork_size, 0);