mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dandan Wu <dand_wu@163.com>
To: linkinjeon@kernel.org, hyc.lee@gmail.com, liubaolin12138@163.com
Cc: ntfs@lists.linux.dev, linux-kernel@vger.kernel.org,
	Dandan Wu <wudandan@kylinos.cn>
Subject: [PATCH v1] ntfs: use kvfree when ascending an index tree
Date: Fri, 20 Nov 2026 17:20:15 +0800	[thread overview]
Message-ID: <20261120092015.2469284-1-dand_wu@163.com> (raw)

From: Dandan Wu <wudandan@kylinos.cn>

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@kylinos.cn>
---
 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


             reply	other threads:[~2026-11-20  9:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20  9:20 Dandan Wu [this message]
2026-11-20  9:27 ` liubaolin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261120092015.2469284-1-dand_wu@163.com \
    --to=dand_wu@163.com \
    --cc=hyc.lee@gmail.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liubaolin12138@163.com \
    --cc=ntfs@lists.linux.dev \
    --cc=wudandan@kylinos.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®