summaryrefslogtreecommitdiff
path: root/mm/filemap.c
diff options
context:
space:
mode:
authorMarco Nelissen <marco.nelissen@gmail.com>2025-01-02 11:04:11 -0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-23 17:21:16 +0100
commit09528bb1a4123e2a234eac2bc45a0e51e78dab43 (patch)
tree502589675dc083056775cfe01c8cadae0b4ae17b /mm/filemap.c
parentc5418187b97780749688d6133d2a43c37e46604e (diff)
downloadlinux-09528bb1a4123e2a234eac2bc45a0e51e78dab43.tar.gz
linux-09528bb1a4123e2a234eac2bc45a0e51e78dab43.tar.bz2
linux-09528bb1a4123e2a234eac2bc45a0e51e78dab43.zip
filemap: avoid truncating 64-bit offset to 32 bits
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: 54fa39ac2e00 ("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>
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 2c308413387f..6a3d62de1cca 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3037,7 +3037,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: