mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-21 11:44:01 +08:00
xfs: check dabtree node hash values when loading child blocks
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> Reviewed-by: Christoph Hellwig <hch@lst.de> Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
parent
8df0fa39bd
commit
e581c9397a
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
return error;
|
||||
out_freebp:
|
||||
|
Loading…
Reference in New Issue
Block a user