提交 5690f921 编写于 作者: C Christoph Hellwig 提交者: Alex Elder

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: NChristoph Hellwig <hch@lst.de>
Reviewed-by: NLachlan McIlroy <lmcilroy@redhat.com>
Signed-off-by: NAlex Elder <aelder@sgi.com>
上级 2f2b3220
...@@ -4825,12 +4825,13 @@ xfs_bmapi( ...@@ -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;
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册