Skip to content

Commit 0fbe9bd

Browse files
marconesmb49
authored andcommitted
filemap: avoid truncating 64-bit offset to 32 bits
BugLink: https://bugs.launchpad.net/bugs/2100328 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/[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]> Signed-off-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Noah Wager <[email protected]> Signed-off-by: Koichiro Den <[email protected]>
1 parent cc43156 commit 0fbe9bd

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
@@ -2981,7 +2981,7 @@ static inline loff_t folio_seek_hole_data(struct xa_state *xas,
29812981
if (ops->is_partially_uptodate(folio, offset, bsz) ==
29822982
seek_data)
29832983
break;
2984-
start = (start + bsz) & ~(bsz - 1);
2984+
start = (start + bsz) & ~((u64)bsz - 1);
29852985
offset += bsz;
29862986
} while (offset < folio_size(folio));
29872987
unlock:

0 commit comments

Comments
 (0)