From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Hongling Zeng <zenghongling@kylinos.cn>
Cc: <ntfs3@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<zhongling0719@126.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH v2] ntfs3: fix buffer overflow in CreateAttribute validation
Date: Wed, 11 Nov 2026 09:46:28 +0100 [thread overview]
Message-ID: <8b98d6c9-2277-43e8-94e3-a00b9de7e2bb@paragon-software.com> (raw)
In-Reply-To: <20260813094129.1366996-1-zenghongling@kylinos.cn>
On 8/13/26 11:41, Hongling Zeng wrote:
> In the CreateAttribute action, the validation checks whether dlen
> fits within the available MFT record space, but the actual memcpy
> uses asize (the attribute size from the log record) as the copy length.
>
> A malicious NTFS journal record can set a small dlen to pass the
> validation while setting a large asize that exceeds the MFT record
> buffer size, causing a buffer overflow when memcpy copies asize bytes
> into the destination buffer.
>
> The validation must use the same size that is later passed to memcpy().
>
> Fix this by using asize in the bounds check instead of dlen, since
> asize is the actual length used by memcpy. The source buffer boundary
> is already validated by the existing check:
> Add2Ptr(attr2, asize) > Add2Ptr(lrh, rec_len)
>
> Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal")
> Cc: stable@vger.kernel.org
> Signed-off-by: Hongling Zeng <zenghongling@kylinos.cn>
> ---
> Change in v2:
> Also fix the lower bound check to use asize instead of dlen. A malicious
> log record with dlen >= 24 (passing dlen < SIZE_OF_RESIDENT check) but
> asize < 24 could allocate insufficient memory and trigger OOB accesses
> in subsequent operations.
> ---
> fs/ntfs3/fslog.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c
> index 3440212ecb12..e15f7621863e 100644
> --- a/fs/ntfs3/fslog.c
> +++ b/fs/ntfs3/fslog.c
> @@ -3285,10 +3285,10 @@ static int do_action(struct ntfs_log *log, struct OPEN_ATTR_ENRTY *oe,
> asize = le32_to_cpu(attr2->size);
> used = le32_to_cpu(rec->used);
>
> - if (!check_if_attr(rec, lrh) || dlen < SIZEOF_RESIDENT ||
> + if (!check_if_attr(rec, lrh) || asize < SIZEOF_RESIDENT ||
> !IS_ALIGNED(asize, 8) ||
> Add2Ptr(attr2, asize) > Add2Ptr(lrh, rec_len) ||
> - dlen > record_size - used) {
> + asize > record_size - used) {
> goto dirty_vol;
> }
>
Hello,
Sorry for the delay.
Your patch was applied, thanks.
Regards,
Konstantin
prev parent reply other threads:[~2026-11-11 8:46 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 9:41 Hongling Zeng
2026-11-11 8:46 ` Konstantin Komarov [this message]
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=8b98d6c9-2277-43e8-94e3-a00b9de7e2bb@paragon-software.com \
--to=almaz.alexandrovich@paragon-software.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ntfs3@lists.linux.dev \
--cc=stable@vger.kernel.org \
--cc=zenghongling@kylinos.cn \
--cc=zhongling0719@126.com \
/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®