aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorDarrick J. Wong <darrick.wong@oracle.com>2017-01-09 10:38:53 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-01-12 05:39:43 -0500
commitb88398de18331ed448739866bf9fe3743e7c1bbf (patch)
treeb474090d13fdfe826d6bbae81d2c9425a81504f5 /fs
parent4bb31bccea381ebadf0e1bc4433026613c15ce68 (diff)
xfs: complain if we don't get nextents bmap records
commit 356a3225222e5bc4df88aef3419fb6424f18ab69 upstream. 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> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-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 d4481d4383ee..a2a24fac28d0 100644
--- a/fs/xfs/libxfs/xfs_bmap.c
+++ b/fs/xfs/libxfs/xfs_bmap.c
@@ -1377,8 +1377,9 @@ xfs_bmap_read_extents(
1377 return error; 1377 return error;
1378 block = XFS_BUF_TO_BLOCK(bp); 1378 block = XFS_BUF_TO_BLOCK(bp);
1379 } 1379 }
1380 if (i != XFS_IFORK_NEXTENTS(ip, whichfork))
1381 return -EFSCORRUPTED;
1380 ASSERT(i == xfs_iext_count(ifp)); 1382 ASSERT(i == xfs_iext_count(ifp));
1381 ASSERT(i == XFS_IFORK_NEXTENTS(ip, whichfork));
1382 XFS_BMAP_TRACE_EXLIST(ip, i, whichfork); 1383 XFS_BMAP_TRACE_EXLIST(ip, i, whichfork);
1383 return 0; 1384 return 0;
1384error0: 1385error0: