Skip to content

Commit

Permalink
xfs: do not use unchecked extent indices in xfs_bmapi
Browse files Browse the repository at this point in the history
Make sure to only call xfs_iext_get_ext after we've validate the
extent index when moving on to the next index in xfs_bmapi.

Based on an earlier patch from Lachlan McIlroy.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Lachlan McIlroy <lmcilroy@redhat.com>
Signed-off-by: Alex Elder <aelder@sgi.com>
  • Loading branch information
Christoph Hellwig authored and Alex Elder committed May 25, 2011
1 parent 2f2b322 commit 5690f92
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions fs/xfs/xfs_bmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -4825,12 +4825,13 @@ xfs_bmapi(
/*
* Else go on to the next record.
*/
ep = xfs_iext_get_ext(ifp, ++lastx);
prev = got;
if (lastx >= nextents)
eof = 1;
else
if (++lastx < nextents) {
ep = xfs_iext_get_ext(ifp, lastx);
xfs_bmbt_get_all(ep, &got);
} else {
eof = 1;
}
}
*nmap = n;
/*
Expand Down

0 comments on commit 5690f92

Please sign in to comment.