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/[email protected] Fixes: 54fa39a ("iomap: use mapping_seek_hole_data") Signed-off-by: Marco Nelissen <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 4bbb6df commit f505e6c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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)