[PATCH v1 04/13] ntfs: allow vmalloc for large runlist backups

From: Baolin Liu

Date: Wed Dec 02 2026 - 23:06:31 EST


From: Baolin Liu <liubaolin@xxxxxxxxxx>

ntfs_attr_map_cluster() backs up the runlist before merging an allocation.
With sufficient fragmentation, the backup exceeds KMALLOC_MAX_SIZE and
kmemdup() triggers an allocation warning. generic/299 with 512-byte
clusters reproduces this with both order-0 and large-folio kernels.

Use kvmemdup() because the backup need not be physically contiguous.
Both normal cleanup and rollback already support kvfree().

Fixes: 91709ba5d6d7 ("ntfs: protect runlist updates with the runlist lock")
Signed-off-by: Baolin Liu <liubaolin@xxxxxxxxxx>
---
fs/ntfs/attrib.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
index 6ee6b6bcac1d..17854043b716 100644
--- a/fs/ntfs/attrib.c
+++ b/fs/ntfs/attrib.c
@@ -5498,8 +5498,8 @@ int ntfs_attr_map_cluster(struct ntfs_inode *ni, s64 vcn_start, s64 *lcn_start,
lcn = rlc->lcn;
clu_count = rlc->length;
old_rl_count = ni->runlist.count;
- old_rl = kmemdup(ni->runlist.rl,
- old_rl_count * sizeof(*old_rl), GFP_NOFS);
+ old_rl = kvmemdup(ni->runlist.rl,
+ old_rl_count * sizeof(*old_rl), GFP_NOFS);
if (!old_rl) {
err = -ENOMEM;
if (ntfs_cluster_free_from_rl(vol, rlc)) {