summaryrefslogtreecommitdiffstats
path: root/fs/xfs
diff options
context:
space:
mode:
authorDarrick J. Wong2016-12-05 02:36:56 +0100
committerDave Chinner2016-12-05 02:36:56 +0100
commit356a3225222e5bc4df88aef3419fb6424f18ab69 (patch)
treeed4f652f393d68b95744b29a38f6db3df3d5abae /fs/xfs
parentxfs: check for bogus values in btree block headers (diff)
downloadkernel-qcow2-linux-356a3225222e5bc4df88aef3419fb6424f18ab69.tar.gz
kernel-qcow2-linux-356a3225222e5bc4df88aef3419fb6424f18ab69.tar.xz
kernel-qcow2-linux-356a3225222e5bc4df88aef3419fb6424f18ab69.zip
xfs: complain if we don't get nextents bmap records
When reading into memory all extents of a btree-format inode fork, complain if the number of extents we find is not the same as the number of extents reported in the inode core. This is needed to stop an IO action from accessing the garbage areas of the in-core fork. [dchinner: removed redundant assert] Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Reviewed-by: Dave Chinner <dchinner@redhat.com> Signed-off-by: Dave Chinner <david@fromorbit.com>
Diffstat (limited to 'fs/xfs')
-rw-r--r--fs/xfs/libxfs/xfs_bmap.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c
index 23aa70b2790c..829ad632533b 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1377,8 +1377,9 @@ xfs_bmap_read_extents(
return error;
block = XFS_BUF_TO_BLOCK(bp);
}
+ if (i != XFS_IFORK_NEXTENTS(ip, whichfork))
+ return -EFSCORRUPTED;
ASSERT(i == xfs_iext_count(ifp));
- ASSERT(i == XFS_IFORK_NEXTENTS(ip, whichfork));
XFS_BMAP_TRACE_EXLIST(ip, i, whichfork);
return 0;
error0: