From: Dave Chinner <david@fromorbit.com>
To: "Darrick J. Wong" <darrick.wong@oracle.com>
Cc: linux-xfs@vger.kernel.org
Subject: Re: [PATCH 2/2] xfs: check dabtree node hash values when loading child blocks
Date: Thu, 17 Sep 2020 14:48:21 +1000 [thread overview]
Message-ID: <20200917044821.GB12131@dread.disaster.area> (raw)
In-Reply-To: <160031331944.3624286.5979437788459484830.stgit@magnolia>
On Wed, Sep 16, 2020 at 08:28:39PM -0700, Darrick J. Wong wrote:
> From: Darrick J. Wong <darrick.wong@oracle.com>
>
> When xchk_da_btree_block is loading a non-root dabtree block, we know
> that the parent block had to have a (hashval, address) pointer to the
> block that we just loaded. Check that the hashval in the parent matches
> the block we just loaded.
>
> This was found by fuzzing nbtree[3].hashval = ones in xfs/394.
>
> Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
> ---
> fs/xfs/scrub/dabtree.c | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
>
> diff --git a/fs/xfs/scrub/dabtree.c b/fs/xfs/scrub/dabtree.c
> index e56786f0a13c..653f3280e1c1 100644
> --- a/fs/xfs/scrub/dabtree.c
> +++ b/fs/xfs/scrub/dabtree.c
> @@ -441,6 +441,20 @@ xchk_da_btree_block(
> goto out_freebp;
> }
>
> + /*
> + * If we've been handed a block that is below the dabtree root, does
> + * its hashval match what the parent block expected to see?
> + */
> + if (level > 0) {
> + struct xfs_da_node_entry *key;
> +
> + key = xchk_da_btree_node_entry(ds, level - 1);
> + if (be32_to_cpu(key->hashval) != blk->hashval) {
> + xchk_da_set_corrupt(ds, level);
> + goto out_freebp;
> + }
> + }
Looks ok.
Reviewed-by: Dave Chinner <dchinner@redhat.com>
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2020-09-17 4:48 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-09-17 3:28 [PATCH 0/2] xfs: random fixes Darrick J. Wong
2020-09-17 3:28 ` [PATCH 1/2] xfs: don't free rt blocks when we're doing a REMAP bunmapi call Darrick J. Wong
2020-09-17 4:43 ` Dave Chinner
2020-09-17 8:11 ` Christoph Hellwig
2020-09-17 17:42 ` Darrick J. Wong
2020-09-18 2:14 ` [PATCH v2 " Darrick J. Wong
2020-09-19 5:14 ` Christoph Hellwig
2020-09-21 6:51 ` Dave Chinner
2020-09-17 3:28 ` [PATCH 2/2] xfs: check dabtree node hash values when loading child blocks Darrick J. Wong
2020-09-17 4:48 ` Dave Chinner [this message]
2020-09-17 8:12 ` Christoph Hellwig
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200917044821.GB12131@dread.disaster.area \
--to=david@fromorbit.com \
--cc=darrick.wong@oracle.com \
--cc=linux-xfs@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.