From: Darrick J. Wong Date: Fri, 5 Oct 2018 02:36:11 +0000 (-0500) Subject: xfs: check da node magic in _node_lookup_int X-Git-Tag: v4.19.0-rc0~17 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b403e029132091a25b34a72e9a12e1bc5f25ecd8;p=thirdparty%2Fxfsprogs-dev.git xfs: check da node magic in _node_lookup_int Source kernel commit: 56830d6cc114f76f656d5e65ab355b070d5a695e Before we start processing what we /think/ is a da3 node block, actually check the magic to make sure that we're looking at a node block. This way we won't blow the asserts in _node_hdr_from_disk on corrupted metadata. Signed-off-by: Darrick J. Wong Reviewed-by: Brian Foster Reviewed-by: Carlos Maiolino Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index cf716574a..4fceab884 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -1518,8 +1518,10 @@ xfs_da3_node_lookup_int( break; } - blk->magic = XFS_DA_NODE_MAGIC; + if (magic != XFS_DA_NODE_MAGIC && magic != XFS_DA3_NODE_MAGIC) + return -EFSCORRUPTED; + blk->magic = XFS_DA_NODE_MAGIC; /* * Search an intermediate node for a match.