mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Konstantin Komarov <almaz.alexandrovich@paragon-software.com>
To: Yi Xie <xieyi@kylinos.cn>, <linkinjeon@kernel.org>
Cc: <ntfs3@lists.linux.dev>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] ntfs3: fix resident attribute handling in run load paths
Date: Thu, 24 Sep 2026 17:35:50 +0200	[thread overview]
Message-ID: <d676f554-5352-4a2e-897f-971cedf6cf67@paragon-software.com> (raw)
In-Reply-To: <20260707021444.57163-1-xieyi@kylinos.cn>

On 7/7/26 04:14, Yi Xie wrote:

> [You don't often get email from xieyi@kylinos.cn. Learn why this is important at https://aka.ms/LearnAboutSenderIdentification ]
>
> Don't dereference nres unless attr->non_res is set.  ni_find_attr() can
> succeed with a resident record on a corrupted image, and run_unpack_ex()
> would mis-parse it as mapping pairs.
>
> Fix attr_load_runs(), attr_load_runs_vcn() and attr_set_size().
>
> Fixes: 5ec75546dc71 ("ntfs: fix WARN_ON for resident attribute in ntfs_map_runlist_nolock()")
> Signed-off-by: Yi Xie <xieyi@kylinos.cn>
> ---
>   fs/ntfs3/attrib.c | 18 +++++++++++++++---
>   1 file changed, 15 insertions(+), 3 deletions(-)
>
> diff --git a/fs/ntfs3/attrib.c b/fs/ntfs3/attrib.c
> index c621a4c582f9..248a6d68eac3 100644
> --- a/fs/ntfs3/attrib.c
> +++ b/fs/ntfs3/attrib.c
> @@ -61,11 +61,16 @@ static int attr_load_runs(struct ATTRIB *attr, struct ntfs_inode *ni,
>                            struct runs_tree *run, const CLST *vcn)
>   {
>          int err;
> -       CLST svcn = le64_to_cpu(attr->nres.svcn);
> -       CLST evcn = le64_to_cpu(attr->nres.evcn);
> +       CLST svcn, evcn;
>          u32 asize;
>          u16 run_off;
>
> +       if (!attr->non_res)
> +               return -EIO;
> +
> +       svcn = le64_to_cpu(attr->nres.svcn);
> +       evcn = le64_to_cpu(attr->nres.evcn);
> +
>          if (svcn >= evcn + 1 || run_is_mapped_full(run, svcn, evcn))
>                  return 0;
>
> @@ -555,6 +560,10 @@ int attr_set_size_ex(struct ntfs_inode *ni, enum ATTR_TYPE type,
>                  }
>
>   next_le_1:
> +               if (!attr->non_res) {
> +                       err = -EIO;
> +                       goto out;
> +               }
>                  svcn = le64_to_cpu(attr->nres.svcn);
>                  evcn = le64_to_cpu(attr->nres.evcn);
>          }
> @@ -1444,6 +1453,9 @@ int attr_load_runs_vcn(struct ntfs_inode *ni, enum ATTR_TYPE type,
>                  return -ENOENT;
>          }
>
> +       if (!attr->non_res)
> +               return -EIO;
> +
>          svcn = le64_to_cpu(attr->nres.svcn);
>          evcn = le64_to_cpu(attr->nres.evcn);
>
> --
> 2.34.1

Hello,

Sorry for the delay.
Your patch was applied, thanks.

Regards,
Konstantin


      reply	other threads:[~2026-09-24 15:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-07  2:14 Yi Xie
2026-09-24 15:35 ` 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=d676f554-5352-4a2e-897f-971cedf6cf67@paragon-software.com \
    --to=almaz.alexandrovich@paragon-software.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ntfs3@lists.linux.dev \
    --cc=xieyi@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®