Skip to content

Commit

Permalink
xfs: xfs_rtbuf_get should check the bmapi_read results
Browse files Browse the repository at this point in the history
The xfs_rtbuf_get function should check the block mapping it gets back
from bmapi_read.  If there are no mappings or the mapping isn't a real
extent, we should return -EFSCORRUPTED rather than trying to read a
garbage value.  We also require realtime bitmap blocks to be real,
written allocations.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Allison Henderson <allison.henderson@oracle.com>
Reviewed-by: Bill O'Donnell <billodo@redhat.com>
  • Loading branch information
Darrick J. Wong committed Jun 1, 2018
1 parent 2483113 commit a03f164
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/xfs/libxfs/xfs_rtbitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ xfs_rtbuf_get(
if (error)
return error;

if (nmap == 0 || !xfs_bmap_is_real_extent(&map))
return -EFSCORRUPTED;

ASSERT(map.br_startblock != NULLFSBLOCK);
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp,
XFS_FSB_TO_DADDR(mp, map.br_startblock),
Expand Down

0 comments on commit a03f164

Please sign in to comment.