1
0
Fork 0
mirror of https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-01-22 16:06:04 -05:00

iomap: avoid avoid truncating 64-bit offset to 32 bits

on 32-bit kernels, iomap_write_delalloc_scan() was inadvertently using a
32-bit position due to folio_next_index() returning an unsigned long.
This could lead to an infinite loop when writing to an xfs filesystem.

Signed-off-by: Marco Nelissen <marco.nelissen@gmail.com>
Link: https://lore.kernel.org/r/20250109041253.2494374-1-marco.nelissen@gmail.com
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Marco Nelissen 2025-01-08 20:11:50 -08:00 committed by Christian Brauner
parent 8fd56ad6e7
commit c13094b894
No known key found for this signature in database
GPG key ID: 91C61BC06578DCA2

View file

@ -1138,7 +1138,7 @@ static void iomap_write_delalloc_scan(struct inode *inode,
start_byte, end_byte, iomap, punch); start_byte, end_byte, iomap, punch);
/* move offset to start of next folio in range */ /* move offset to start of next folio in range */
start_byte = folio_next_index(folio) << PAGE_SHIFT; start_byte = folio_pos(folio) + folio_size(folio);
folio_unlock(folio); folio_unlock(folio);
folio_put(folio); folio_put(folio);
} }