xfs: do not use unchecked extent indices in xfs_bmapi
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>
This commit is contained in:
committed by
Alex Elder
parent
2f2b3220b0
commit
5690f92199
@@ -4825,12 +4825,13 @@ xfs_bmapi(
|
|||||||
/*
|
/*
|
||||||
* Else go on to the next record.
|
* Else go on to the next record.
|
||||||
*/
|
*/
|
||||||
ep = xfs_iext_get_ext(ifp, ++lastx);
|
|
||||||
prev = got;
|
prev = got;
|
||||||
if (lastx >= nextents)
|
if (++lastx < nextents) {
|
||||||
eof = 1;
|
ep = xfs_iext_get_ext(ifp, lastx);
|
||||||
else
|
|
||||||
xfs_bmbt_get_all(ep, &got);
|
xfs_bmbt_get_all(ep, &got);
|
||||||
|
} else {
|
||||||
|
eof = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
*nmap = n;
|
*nmap = n;
|
||||||
/*
|
/*
|
||||||
|
Reference in New Issue
Block a user