xfs: add missing cursor status check after xfs_inobt_get_rec

The xfs_inobt_get_rec() call in xfs_ialloc_count_ondisk fails to check
the &has_record return - if the record is not found, the next
conditional will read an uninitialized  or stale irec. Fix that.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
This commit is contained in:
Eric Sandeen 2026-10-13 19:16:39 -05:00 committed by Carlos Maiolino
parent 90388d46b0
commit 5beb41df46

View File

@ -2843,6 +2843,11 @@ xfs_ialloc_count_ondisk(
error = xfs_inobt_get_rec(cur, &irec, &has_record);
if (error)
return error;
if (XFS_IS_CORRUPT(cur->bc_mp, has_record != 1)) {
xfs_btree_mark_sick(cur);
return -EFSCORRUPTED;
}
if (irec.ir_startino > high)
break;