xfs: filter out obviously bad btree pointers

Don't let anybody load an obviously bad btree pointer.  Since the values
come from disk, we must return an error, not just ASSERT.

Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: Eric Sandeen <sandeen@redhat.com>
This commit is contained in:
Darrick J. Wong 2017-02-02 15:13:58 -08:00
parent 7a652bbe36
commit d5a91baeb6
3 changed files with 4 additions and 6 deletions

View file

@ -826,7 +826,8 @@ xfs_btree_read_bufl(
xfs_daddr_t d; /* real disk block address */
int error;
ASSERT(fsbno != NULLFSBLOCK);
if (!XFS_FSB_SANITY_CHECK(mp, fsbno))
return -EFSCORRUPTED;
d = XFS_FSB_TO_DADDR(mp, fsbno);
error = xfs_trans_read_buf(mp, tp, mp->m_ddev_targp, d,
mp->m_bsize, lock, &bp, ops);