From: Greg KH <greg@kroah.com>
To: Sasha Levin <sashal@kernel.org>
Cc: stable@vger.kernel.org,
Konstantin Komarov <almaz.alexandrovich@paragon-software.com>,
lei lu <llfamsec@gmail.com>
Subject: Re: [PATCH 6.12.y 1/4] fs/ntfs3: Add more checks in mi_enum_attr (part 2)
Date: Wed, 30 Sep 2026 15:45:19 +0200 [thread overview]
Message-ID: <2026093016-basin-decaf-16c0@gregkh> (raw)
In-Reply-To: <20260910012610.3866859-1-sashal@kernel.org>
On Wed, Sep 09, 2026 at 09:26:07PM -0400, Sasha Levin wrote:
> From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
>
> [ Upstream commit a8f659ce14f8f734894227ba2c5ca78c8451501e ]
>
> Add offset check before access to attr->non_res field as mentioned in [1].
>
> [1] https://lore.kernel.org/ntfs3/20241010110005.42792-1-llfamsec@gmail.com/
>
> Suggested-by: lei lu <llfamsec@gmail.com>
> Signed-off-by: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
> Stable-dep-of: 7c4841e2a627 ("fs/ntfs3: fix slab-out-of-bounds write in ni_create_attr_list()")
> Signed-off-by: Sasha Levin <sashal@kernel.org>
> ---
> fs/ntfs3/record.c | 16 +++++++++++++---
> 1 file changed, 13 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ntfs3/record.c b/fs/ntfs3/record.c
> index f810f0419d25e..61d53d39f3b9f 100644
> --- a/fs/ntfs3/record.c
> +++ b/fs/ntfs3/record.c
> @@ -212,7 +212,7 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
> return NULL;
>
> if (off >= used || off < MFTRECORD_FIXUP_OFFSET_1 ||
> - !IS_ALIGNED(off, 4)) {
> + !IS_ALIGNED(off, 8)) {
> return NULL;
> }
>
> @@ -236,8 +236,11 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
> off += asize;
> }
>
> - /* Can we use the first field (attr->type). */
> - /* NOTE: this code also checks attr->size availability. */
> + /*
> + * Can we use the first fields:
> + * attr->type,
> + * attr->size
> + */
> if (off + 8 > used) {
> static_assert(ALIGN(sizeof(enum ATTR_TYPE), 8) == 8);
> return NULL;
> @@ -259,10 +262,17 @@ struct ATTRIB *mi_enum_attr(struct mft_inode *mi, struct ATTRIB *attr)
>
> asize = le32_to_cpu(attr->size);
>
> + if (!IS_ALIGNED(asize, 8))
> + return NULL;
> +
> /* Check overflow and boundary. */
> if (off + asize < off || off + asize > used)
> return NULL;
>
> + /* Can we use the field attr->non_res. */
> + if (off + 9 > used)
> + return NULL;
> +
> /* Check size of attribute. */
> if (!attr->non_res) {
> /* Check resident fields. */
> --
> 2.53.0
>
>
did not apply
prev parent reply other threads:[~2026-09-30 13:45 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-08 10:01 FAILED: patch "[PATCH] fs/ntfs3: fix slab-out-of-bounds write in" failed to apply to 6.12-stable tree gregkh
2026-09-10 1:26 ` [PATCH 6.12.y 1/4] fs/ntfs3: Add more checks in mi_enum_attr (part 2) Sasha Levin
2026-09-10 1:26 ` [PATCH 6.12.y 2/4] fs/ntfs3: Mark inode as bad as soon as error detected in mi_enum_attr() Sasha Levin
2026-09-10 1:26 ` [PATCH 6.12.y 3/4] fs/ntfs3: fix KMSAN uninit-value in ni_create_attr_list Sasha Levin
2026-09-10 1:26 ` [PATCH 6.12.y 4/4] fs/ntfs3: fix slab-out-of-bounds write in ni_create_attr_list() Sasha Levin
2026-09-30 13:45 ` Greg KH [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=2026093016-basin-decaf-16c0@gregkh \
--to=greg@kroah.com \
--cc=almaz.alexandrovich@paragon-software.com \
--cc=llfamsec@gmail.com \
--cc=sashal@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.