Commit 51e6104f authored by Dave Chinner's avatar Dave Chinner Committed by Dave Chinner
Browse files

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: default avatarDave Chinner <dchinner@redhat.com>
Reviewed-by: default avatarAllison Henderson <allison.henderson@oracle.com>
Reviewed-by: default avatarDarrick J. Wong <djwong@kernel.org>
Signed-off-by: default avatarDave Chinner <david@fromorbit.com>
parent fdaf1bb3
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -310,6 +310,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.