From: Darrick J. Wong Date: Thu, 28 Jun 2018 20:11:57 +0000 (-0500) Subject: xfs: don't return garbage buffers in xfs_da3_node_read X-Git-Tag: v4.18.0-rc0~21 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=52581d38d832b4345aeaa1b68284fffab073b42a;p=thirdparty%2Fxfsprogs-dev.git xfs: don't return garbage buffers in xfs_da3_node_read Source kernel commit: 924cade4df49e7c9fddcbae678dbd9dee3b0aeb6 If we're reading a node in a dir/attr btree and the buffer comes off the disk with a magic number we don't recognize, don't ASSERT and don't set a garbage buffer type (0 also triggers ASSERTs). Instead, report the corruption, release the buffer, and return -EFSCORRUPTED because that's what the dabtree is -- corrupt. Signed-off-by: Darrick J. Wong Reviewed-by: Dave Chinner Signed-off-by: Eric Sandeen --- diff --git a/libxfs/xfs_da_btree.c b/libxfs/xfs_da_btree.c index 269edf9a2..5f71d817f 100644 --- a/libxfs/xfs_da_btree.c +++ b/libxfs/xfs_da_btree.c @@ -300,9 +300,11 @@ xfs_da3_node_read( type = XFS_BLFT_DIR_LEAFN_BUF; break; default: - type = 0; - ASSERT(0); - break; + XFS_CORRUPTION_ERROR(__func__, XFS_ERRLEVEL_LOW, + tp->t_mountp, info); + xfs_trans_brelse(tp, *bpp); + *bpp = NULL; + return -EFSCORRUPTED; } xfs_trans_buf_set_type(tp, *bpp, type); }