[PATCH v1] ntfs: use kvfree when ascending an index tree
From: Dandan Wu
Date: Fri Nov 20 2026 - 04:20:52 EST
From: Dandan Wu <wudandan@xxxxxxxxxx>
ntfs_index_walk_down() allocates the index block with kvzalloc(), which
may return vmalloc memory. When traversal ascends back to the root,
ntfs_index_walk_up() passes that block to kfree(), which cannot free a
vmalloc allocation.
Use kvfree(), as the index context cleanup already does, to handle both
allocation types.
Fixes: 0a8ac0c1fa0b ("ntfs: update directory operations")
Signed-off-by: Dandan Wu <wudandan@xxxxxxxxxx>
---
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 b4462f760e3b..d565accb05d5 100644
--- a/fs/ntfs/index.c
+++ b/fs/ntfs/index.c
@@ -2274,7 +2274,7 @@ static struct index_entry *ntfs_index_walk_up(struct index_entry *ie,
ictx->pindex--;
if (!ictx->pindex) {
/* we have reached the root */
- kfree(ictx->ib);
+ kvfree(ictx->ib);
ictx->ib = NULL;
ictx->is_in_root = true;
/* a new search context is to be allocated */
--
2.25.1