Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5690f921 authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Alex Elder
Browse files

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: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarLachlan McIlroy <lmcilroy@redhat.com>
Signed-off-by: default avatarAlex Elder <aelder@sgi.com>
parent 2f2b3220
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -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;
	/*