Skip to content

Commit 09528bb

Browse files
marconegregkh
authored andcommitted
filemap: avoid truncating 64-bit offset to 32 bits
commit f505e6c upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent c541818 commit 09528bb

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
@@ -3037,7 +3037,7 @@ static inline loff_t folio_seek_hole_data(struct xa_state *xas,
30373037
if (ops->is_partially_uptodate(folio, offset, bsz) ==
30383038
seek_data)
30393039
break;
3040-
start = (start + bsz) & ~(bsz - 1);
3040+
start = (start + bsz) & ~((u64)bsz - 1);
30413041
offset += bsz;
30423042
} while (offset < folio_size(folio));
30433043
unlock:

0 commit comments

Comments
 (0)