summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_da_btree.c
diff options
context:
space:
mode:
authorDarrick J. Wong2018-08-01 16:40:48 +0200
committerDarrick J. Wong2018-08-01 16:42:43 +0200
commit56830d6cc114f76f656d5e65ab355b070d5a695e (patch)
treef42379c8e711f80b3da29580490592c82a7c841d /fs/xfs/libxfs/xfs_da_btree.c
parentxfs: use a local variable for magic number in xfs_da3_node_lookup_int (diff)
downloadkernel-qcow2-linux-56830d6cc114f76f656d5e65ab355b070d5a695e.tar.gz
kernel-qcow2-linux-56830d6cc114f76f656d5e65ab355b070d5a695e.tar.xz
kernel-qcow2-linux-56830d6cc114f76f656d5e65ab355b070d5a695e.zip
xfs: check da node magic in _node_lookup_int
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 <darrick.wong@oracle.com> Reviewed-by: Brian Foster <bfoster@redhat.com> Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Diffstat (limited to 'fs/xfs/libxfs/xfs_da_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index 8ffe17b223da..376bee94b5dd 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -1523,8 +1523,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.