Skip to content

Commit b3f8379

Browse files
marconesmb49
authored andcommitted
filemap: avoid truncating 64-bit offset to 32 bits
BugLink: https://bugs.launchpad.net/bugs/2107449 commit f505e6c91e7a22d10316665a86d79f84d9f0ba76 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> CVE-2025-21665 Signed-off-by: Koichiro Den <koichiro.den@canonical.com> Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
1 parent 13b8628 commit b3f8379

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

0 commit comments

Comments
 (0)