From: Dave Chinner Date: Wed, 22 Jun 2022 19:28:52 +0000 (-0500) Subject: xfs: detect empty attr leaf blocks in xfs_attr3_leaf_verify X-Git-Tag: v5.19.0-rc0~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d45dd440f5ef2229ab3c671870e993a342415d5b;p=thirdparty%2Fxfsprogs-dev.git xfs: detect empty attr leaf blocks in xfs_attr3_leaf_verify Source kernel commit: 51e6104fdb95f377c8741794778319bd413f4fff xfs_repair flags these as a corruption error, so the verifier should catch software bugs that result in empty leaf blocks being written to disk, too. Signed-off-by: Dave Chinner Reviewed-by: Allison Henderson Reviewed-by: Darrick J. Wong Signed-off-by: Dave Chinner Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_attr_leaf.c b/libxfs/xfs_attr_leaf.c index 04f34d0ee..75b8f08ed 100644 --- a/libxfs/xfs_attr_leaf.c +++ b/libxfs/xfs_attr_leaf.c @@ -307,6 +307,15 @@ xfs_attr3_leaf_verify( if (fa) return fa; + /* + * Empty leaf blocks should never occur; they imply the existence of a + * software bug that needs fixing. xfs_repair also flags them as a + * corruption that needs fixing, so we should never let these go to + * disk. + */ + if (ichdr.count == 0) + return __this_address; + /* * firstused is the block offset of the first name info structure. * Make sure it doesn't go off the block or crash into the header.