Re: [PATCH] xfs: sanitize da node pad field on write

Dave Chinner
2026-04-21T21:52:48Z

On Tue, Apr 21, 2026 at 06:43:12AM +0100, Yuto Ohnuki wrote:
> The DA node block header (xfs_da3_node_hdr) contains a __pad32 field
> that should always be zero. Prior to commit a45086e27dfa21 ("xfs:
> validate metadata LSNs against log on v5 superblocks"),
> xfs_da3_node_create() did not zero the full header, so __pad32 could
> contain stale data on older filesystems.
>
> Clear this field in the write verifier to ensure it is corrected
> whenever the block is next written to disk.
>
> Suggested-by: "Darrick J. Wong" <djwong@kernel.org>
> Signed-off-by: Yuto Ohnuki <ytohnuki@amazon.com>
> ---
> fs/xfs/libxfs/xfs_da_btree.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
> index ad801b7bd2dd..f6054a47d24c 100644
> --- a/fs/xfs/libxfs/xfs_da_btree.c
> +++ b/fs/xfs/libxfs/xfs_da_btree.c
> @@ -318,6 +318,8 @@ xfs_da3_node_write_verify(
> if (bip)
> hdr3->info.lsn = cpu_to_be64(bip->bli_item.li_lsn);
>
> + hdr3->__pad32 = 0;
> +

Please add a comment explaining why the padding is being written
unconditionally here. By itself like this it makes no sense at all.

-Dave.
--
Dave Chinner
dgc@kernel.org