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

Commit a37f7b12 authored by Darrick J. Wong's avatar Darrick J. Wong
Browse files

xfs: xfs_alloc_get_rec should return EFSCORRUPTED for obvious bnobt corruption



Return -EFSCORRUPTED when the bnobt/cntbt return obviously corrupt
values, rather than letting them bounce around in the internal code.

Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
Reviewed-by: default avatarDave Chinner <dchinner@redhat.com>
parent b3986010
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -231,10 +231,14 @@ xfs_alloc_get_rec(
	int			error;

	error = xfs_btree_get_rec(cur, &rec, stat);
	if (!error && *stat == 1) {
	if (error || !(*stat))
		return error;
	if (rec->alloc.ar_blockcount == 0)
		return -EFSCORRUPTED;

	*bno = be32_to_cpu(rec->alloc.ar_startblock);
	*len = be32_to_cpu(rec->alloc.ar_blockcount);
	}

	return error;
}