Skip to content

Commit f505e6c

Browse files
marconeakpm00
authored andcommitted
filemap: avoid truncating 64-bit offset to 32 bits
On 32-bit kernels, folio_seek_hole_data() was inadvertently truncating a 64-bit value to 32 bits, leading to a possible infinite loop when writing to an xfs filesystem. Link: https://lkml.kernel.org/r/20250102190540.1356838-1-marco.nelissen@gmail.com Fixes: 54fa39a ("iomap: use mapping_seek_hole_data") Signed-off-by: Marco Nelissen <marco.nelissen@gmail.com> Cc: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
1 parent 4bbb6df commit f505e6c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/filemap.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2996,7 +2996,7 @@ static inline loff_t folio_seek_hole_data(struct xa_state *xas,
29962996
if (ops->is_partially_uptodate(folio, offset, bsz) ==
29972997
seek_data)
29982998
break;
2999-
start = (start + bsz) & ~(bsz - 1);
2999+
start = (start + bsz) & ~((u64)bsz - 1);
30003000
offset += bsz;
30013001
} while (offset < folio_size(folio));
30023002
unlock:

0 commit comments

Comments
 (0)