Skip to content

Commit 51e6104

Browse files
Dave Chinnerdchinner
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 <[email protected]> Reviewed-by: Allison Henderson <[email protected]> Reviewed-by: Darrick J. Wong <[email protected]> Signed-off-by: Dave Chinner <[email protected]>
1 parent fdaf1bb commit 51e6104

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

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)