From: Yuto Ohnuki Date: Sat, 28 Mar 2026 17:34:10 +0000 (+0000) Subject: xfs: fix integer overflow in busy extent sort comparator X-Git-Tag: v7.1-rc1~225^2~13 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=553a13e2076d64774910d597977a17022625763d;p=thirdparty%2Fkernel%2Flinux.git xfs: fix integer overflow in busy extent sort comparator xfs_extent_busy_ag_cmp() subtracts two uint32_t values (group numbers and block numbers) and returns the result as s32. When the difference exceeds INT_MAX, the result overflows and the sort order is corrupted. Use cmp_int() instead, as was done in commit 362c49098086 ("xfs: fix integer overflow in bmap intent sort comparator"). Fixes: 4a137e09151e ("xfs: keep a reference to the pag for busy extents") Signed-off-by: Yuto Ohnuki Reviewed-by: Christoph Hellwig Reviewed-by: Carlos Maiolino Signed-off-by: Carlos Maiolino --- diff --git a/fs/xfs/xfs_extent_busy.c b/fs/xfs/xfs_extent_busy.c index 3efdca3d675bf..41cf0605ec22e 100644 --- a/fs/xfs/xfs_extent_busy.c +++ b/fs/xfs/xfs_extent_busy.c @@ -690,9 +690,9 @@ xfs_extent_busy_ag_cmp( container_of(l2, struct xfs_extent_busy, list); s32 diff; - diff = b1->group->xg_gno - b2->group->xg_gno; + diff = cmp_int(b1->group->xg_gno, b2->group->xg_gno); if (!diff) - diff = b1->bno - b2->bno; + diff = cmp_int(b1->bno, b2->bno); return diff; }