Message ID | 148072893359.12995.10240545634733611493.stgit@birch.djwong.org (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
On Fri, Dec 02, 2016 at 05:35:33PM -0800, Darrick J. Wong wrote: > 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. > > Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> > --- > fs/xfs/libxfs/xfs_bmap.c | 2 ++ > 1 file changed, 2 insertions(+) > > > diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c > index 6f28814..9821161 100644 > --- a/fs/xfs/libxfs/xfs_bmap.c > +++ b/fs/xfs/libxfs/xfs_bmap.c > @@ -1375,6 +1375,8 @@ 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)); This assert is now redundant and can be removed (which I've done). Cheers, Dave.
diff --git a/fs/xfs/libxfs/xfs_bmap.c b/fs/xfs/libxfs/xfs_bmap.c index 6f28814..9821161 100644 --- a/fs/xfs/libxfs/xfs_bmap.c +++ b/fs/xfs/libxfs/xfs_bmap.c @@ -1375,6 +1375,8 @@ 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);
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. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> --- fs/xfs/libxfs/xfs_bmap.c | 2 ++ 1 file changed, 2 insertions(+) -- To unsubscribe from this list: send the line "unsubscribe linux-xfs" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html