From: "Iván Ezequiel Rodriguez" <ivanrwcm25@gmail.com>
To: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
ntfs3@lists.linux.dev
Cc: Jiasheng Jiang <jiashengjiangcool@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] fs/ntfs3: use put_indx_node() in indx_find_sort()
Date: Mon, 2 Nov 2026 11:53:22 -0300 [thread overview]
Message-ID: <20261102145322.169626-1-ivanrwcm25@gmail.com> (raw)
indx_find_sort() frees struct indx_node without nb_put(): bare kfree()
on two error paths, and kfree(index)+kfree(node) on pop. Buffer heads
taken by indx_read() therefore leak. Use put_indx_node(), as
indx_find_raw() already does.
194491be54e1 freed n->index on pop only; bh refs and the error paths
were left. Jiasheng Jiang sent the complete put_indx_node() change
earlier (v2) but it was not merged.
QEMU: 300 distinct system.ntfs_security inserts; unpatched pop path
holds nbufs=1 across teardown, patched does not.
Link: https://lore.kernel.org/all/20260118185736.41529-1-jiashengjiangcool@gmail.com/
Fixes: 82cae269cfa9 ("fs/ntfs3: Add initialization of super block")
Signed-off-by: Iván Ezequiel Rodriguez <ivanrwcm25@gmail.com>
---
fs/ntfs3/index.c | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/fs/ntfs3/index.c b/fs/ntfs3/index.c
index c06b36760448..00dc87818dfb 100644
--- a/fs/ntfs3/index.c
+++ b/fs/ntfs3/index.c
@@ -1297,7 +1297,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,
sizeof(struct NTFS_DE) + sizeof(u64)) {
if (n) {
fnd_pop(fnd);
- kfree(n);
+ put_indx_node(n);
}
return -EINVAL;
}
@@ -1310,7 +1310,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,
/* Try next level. */
e = hdr_first_de(&n->index->ihdr);
if (!e) {
- kfree(n);
+ put_indx_node(n);
return -EINVAL;
}
@@ -1330,8 +1330,7 @@ int indx_find_sort(struct ntfs_index *indx, struct ntfs_inode *ni,
/* Pop one level. */
if (n) {
fnd_pop(fnd);
- kfree(n->index);
- kfree(n);
+ put_indx_node(n);
}
level = fnd->level;
--
2.43.0
reply other threads:[~2026-11-02 14:53 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20261102145322.169626-1-ivanrwcm25@gmail.com \
--to=ivanrwcm25@gmail.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=jiashengjiangcool@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
/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®