]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
xfs: fix integer overflow in deferred intent sort comparators
authorYuto Ohnuki <ytohnuki@amazon.com>
Sat, 28 Mar 2026 17:34:09 +0000 (17:34 +0000)
committerCarlos Maiolino <cem@kernel.org>
Tue, 7 Apr 2026 11:08:27 +0000 (13:08 +0200)
commit59e586d7dc7813910abe20a8281bbc3f1360e08e
treed822ab4444f59a2cec09d326d9123069ba833f7b
parente92b3fc5b17c75d3ca31983a7d35e8b88786ee4e
xfs: fix integer overflow in deferred intent sort comparators

xfs_extent_free_diff_items(), xfs_refcount_update_diff_items(), and
xfs_rmap_update_diff_items() subtract two uint32_t group numbers
and return the result as int, which can overflow when the difference
exceeds INT_MAX.

Use cmp_int() instead, as was done in commit 362c49098086 ("xfs:
fix integer overflow in bmap intent sort comparator").

Fixes: c13418e8eb37 ("xfs: give xfs_rmap_intent its own perag reference")
Fixes: f6b384631e1e ("xfs: give xfs_extfree_intent its own perag reference")
Fixes: 00e7b3bac1dc ("xfs: give xfs_refcount_intent its own perag reference")
Signed-off-by: Yuto Ohnuki <ytohnuki@amazon.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Carlos Maiolino <cmaiolino@redhat.com>
Signed-off-by: Carlos Maiolino <cem@kernel.org>
fs/xfs/xfs_extfree_item.c
fs/xfs/xfs_refcount_item.c
fs/xfs/xfs_rmap_item.c