xfs: don't return garbage buffers in xfs_da3_node_read

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 <darrick.wong@oracle.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
This commit is contained in:
Darrick J. Wong 2018-06-03 16:10:18 -07:00
parent 1f5c071d19
commit 924cade4df
1 changed files with 5 additions and 3 deletions

View File

@ -305,9 +305,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);
}