Skip to content

Commit 51e6104

Browse files
dgchinnerdchinner
authored andcommitted
xfs: detect empty attr leaf blocks in xfs_attr3_leaf_verify
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 <dchinner@redhat.com> Reviewed-by: Allison Henderson <allison.henderson@oracle.com> Reviewed-by: Darrick J. Wong <djwong@kernel.org> Signed-off-by: Dave Chinner <david@fromorbit.com>
1 parent fdaf1bb commit 51e6104

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

fs/xfs/libxfs/xfs_attr_leaf.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -310,6 +310,15 @@ xfs_attr3_leaf_verify(
310310
if (fa)
311311
return fa;
312312

313+
/*
314+
* Empty leaf blocks should never occur; they imply the existence of a
315+
* software bug that needs fixing. xfs_repair also flags them as a
316+
* corruption that needs fixing, so we should never let these go to
317+
* disk.
318+
*/
319+
if (ichdr.count == 0)
320+
return __this_address;
321+
313322
/*
314323
* firstused is the block offset of the first name info structure.
315324
* Make sure it doesn't go off the block or crash into the header.

0 commit comments

Comments
 (0)