xfs: abort dir/attr btree operation if btree is obviously weird
authorDarrick J. Wong <darrick.wong@oracle.com>
Wed, 25 Oct 2017 23:59:43 +0000 (16:59 -0700)
committerDarrick J. Wong <darrick.wong@oracle.com>
Fri, 27 Oct 2017 16:20:31 +0000 (09:20 -0700)
commit8210f4dda2d7642cb7c882db55e53d899cced401
treebcc197df6ce3248726b89fe63fb0aa7ae204e1a8
parentbdaac93f80b84aad2dd9316a3ffb6626b86c13e0
xfs: abort dir/attr btree operation if btree is obviously weird

Abort an dir/attr btree operation if the attr btree has obvious problems
like loops back to the root or pointers don't point down the tree.
Found by fuzzing btree[0].before to zero in xfs/402, which livelocks on
the cycle in the attr btree.

Apply the same checks to xfs_da3_node_lookup_int.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Brian Foster <bfoster@redhat.com>
fs/xfs/libxfs/xfs_da_btree.c
fs/xfs/xfs_attr_list.c