[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250102190540.1356838-1-marco.nelissen@gmail.com>
Date: Thu, 2 Jan 2025 11:04:11 -0800
From: Marco Nelissen <marco.nelissen@...il.com>
To: "Matthew Wilcox (Oracle)" <willy@...radead.org>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org,
linux-kernel@...r.kernel.org,
linux-xfs@...r.kernel.org
Cc: Marco Nelissen <marco.nelissen@...il.com>
Subject: [PATCH] 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.
Signed-off-by: Marco Nelissen <marco.nelissen@...il.com>
---
mm/filemap.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mm/filemap.c b/mm/filemap.c
index f61cf51c2238..f5c93683dbcf 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -3005,7 +3005,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:
--
2.39.5
Powered by blists - more mailing lists