summaryrefslogtreecommitdiffstats
path: root/fs/xfs/libxfs/xfs_da_btree.c
diff options
context:
space:
mode:
authorDarrick J. Wong2018-06-04 01:10:18 +0200
committerDarrick J. Wong2018-06-04 23:45:30 +0200
commit924cade4df49e7c9fddcbae678dbd9dee3b0aeb6 (patch)
treecf1ada3976b328ba3ff31aa7803c19b17ef76614 /fs/xfs/libxfs/xfs_da_btree.c
parentxfs: don't ASSERT on short form btree root pointer of zero (diff)
downloadkernel-qcow2-linux-924cade4df49e7c9fddcbae678dbd9dee3b0aeb6.tar.gz
kernel-qcow2-linux-924cade4df49e7c9fddcbae678dbd9dee3b0aeb6.tar.xz
kernel-qcow2-linux-924cade4df49e7c9fddcbae678dbd9dee3b0aeb6.zip
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>
Diffstat (limited to 'fs/xfs/libxfs/xfs_da_btree.c')
-rw-r--r--fs/xfs/libxfs/xfs_da_btree.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/fs/xfs/libxfs/xfs_da_btree.c b/fs/xfs/libxfs/xfs_da_btree.c
index ea187b4a7991..39c1013358ed 100644
--- a/fs/xfs/libxfs/xfs_da_btree.c
+++ b/fs/xfs/libxfs/xfs_da_btree.c
@@ -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);
}