blob: a908929e115a8ca21565b6b2379e904d21792a41 [file]
From 258c8c9e3acbfb913d9dc7c251d65c567cd8eaa4 Mon Sep 17 00:00:00 2001
From: Sasha Levin <sashal@kernel.org>
Date: Wed, 28 Oct 2026 17:42:47 +0900
Subject: ntfs: initialize VCN when inserting index entries
From: Hyunchul Lee <hyc.lee@gmail.com>
[ Upstream commit 1f3c5ba3c55c112a0b33c03caa9d5f88bb9e7759 ]
When a leaf index entry is promoted during a split,
ntfs_ih_insert() extends a copied entry with the NODE VCN field.
Initialize that field before copying the new entry into the parent
index. The promoted entry must reference the old child VCN, while
the existing parent entry is updated to reference the newly allocated
right child.
Fixes: 0a8ac0c1fa0b ("ntfs: update directory operations")
Signed-off-by: Hyunchul Lee <hyc.lee@gmail.com>
Signed-off-by: Namjae Jeon <linkinjeon@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
fs/ntfs/index.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/ntfs/index.c b/fs/ntfs/index.c
index 9a23d0786959b..9309e617451e1 100644
--- a/fs/ntfs/index.c
+++ b/fs/ntfs/index.c
@@ -1547,9 +1547,9 @@ static int ntfs_ih_insert(struct index_header *ih, struct index_entry *orig_ie,
ie_node = ntfs_ie_get_by_pos(ih, pos);
old_vcn = ntfs_ie_get_vcn(ie_node);
ntfs_ie_set_vcn(ie_node, new_vcn);
+ ntfs_ie_set_vcn(ie, old_vcn);
ntfs_ie_insert(ih, ie, ie_node);
- ntfs_ie_set_vcn(ie_node, old_vcn);
out:
kfree(ie);
return ret;
--
2.53.0