aboutsummaryrefslogtreecommitdiffstats
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorMarco Nelissen <[email protected]>2025-01-02 19:04:11 +0000
committerAndrew Morton <[email protected]>2025-01-13 03:03:35 +0000
commitf505e6c91e7a22d10316665a86d79f84d9f0ba76 (patch)
tree018447b6a0a1d132d5ac764fc54ae4d11d0131e7 /mm/filemap.c
parenttools: fix atomic_set() definition to set the value correctly (diff)
downloadkernel-f505e6c91e7a22d10316665a86d79f84d9f0ba76.tar.gz
kernel-f505e6c91e7a22d10316665a86d79f84d9f0ba76.zip
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: 54fa39ac2e00 ("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]>
Diffstat (limited to 'mm/filemap.c')
-rw-r--r--mm/filemap.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/filemap.c b/mm/filemap.c
index 33b60d448fca..118fa1e0bafe 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -2996,7 +2996,7 @@ static inline loff_t folio_seek_hole_data(struct xa_state *xas,
if (ops->is_partially_uptodate(folio, offset, bsz) ==
seek_data)
break;
- start = (start + bsz) & ~(bsz - 1);
+ start = (start + bsz) & ~((u64)bsz - 1);
offset += bsz;
} while (offset < folio_size(folio));
unlock: