From: Greg KH <gregkh@linuxfoundation.org>
To: Peiyang He <peiyang_he@smail.nju.edu.cn>
Cc: Namjae Jeon <linkinjeon@kernel.org>,
Hyunchul Lee <hyc.lee@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] ntfs: fix hole runlist memory leak in insert range error path
Date: Sun, 5 Jul 2026 12:13:58 +0200 [thread overview]
Message-ID: <2026070550-certainly-ladle-dc6f@gregkh> (raw)
In-Reply-To: <5A2D944D5FE68879+20260705100554.3797781-1-peiyang_he@smail.nju.edu.cn>
On Sun, Jul 05, 2026 at 06:05:54PM +0800, Peiyang He wrote:
> ntfs_non_resident_attr_insert_range() allocates hole_rl before mapping the
> whole runlist. If ntfs_attr_map_whole_runlist() fails, the error path drops
> ni->runlist.lock and returns without freeing hole_rl. This causes memory leak
> of sizeof(*hole_rl) * 2 bytes.
>
> Fix this memory leak by freeing hole_rl before returning from that error path,
> matching the later error paths in the same function.
>
> Fixes: 495e90fa3348 ("ntfs: update attrib operations")
> Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
> ---
> fs/ntfs/attrib.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/ntfs/attrib.c b/fs/ntfs/attrib.c
> index dd8828098511..55603df0a2ed 100644
> --- a/fs/ntfs/attrib.c
> +++ b/fs/ntfs/attrib.c
> @@ -5325,6 +5325,7 @@ int ntfs_non_resident_attr_insert_range(struct ntfs_inode *ni, s64 start_vcn, s6
> ret = ntfs_attr_map_whole_runlist(ni);
> if (ret) {
> up_write(&ni->runlist.lock);
> + kfree(hole_rl);
> return ret;
> }
>
>
> base-commit: 1a3746ccbb0a97bed3c06ccde6b880013b1dddc1
> --
> 2.43.0
>
>
<formletter>
This is not the correct way to submit patches for inclusion in the
stable kernel tree. Please read:
https://www.kernel.org/doc/html/latest/process/stable-kernel-rules.html
for how to do this properly.
</formletter>
next prev parent reply other threads:[~2026-07-05 10:15 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-05 10:05 [PATCH] ntfs: fix hole runlist memory leak in insert range error path Peiyang He
2026-07-05 10:13 ` Greg KH [this message]
2026-07-05 11:14 ` [PATCH v2] " Peiyang He
2026-07-06 0:25 ` Hyunchul Lee
2026-07-06 11:31 ` Namjae Jeon
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=2026070550-certainly-ladle-dc6f@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=hyc.lee@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peiyang_he@smail.nju.edu.cn \
--cc=stable@vger.kernel.org \
/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