From: Namjae Jeon <linkinjeon@kernel.org>
To: Dennis Tighe <dennis.tighe@gmail.com>
Cc: Hyunchul Lee <hyc.lee@gmail.com>,
linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] ntfs: reject invalid sectors_per_cluster in the boot sector
Date: Wed, 26 Aug 2026 20:41:43 +0900 [thread overview]
Message-ID: <CAKYAXd8YDpTrru8aB343K-22hReS3_Hqa3JuEbxumaMPdLetTA@mail.gmail.com> (raw)
In-Reply-To: <6a8e7511.9e2d85f8.1d4e3b.c404@mx.google.com>
On Wed, Aug 26, 2026 at 2:09 PM Dennis Tighe <dennis.tighe@gmail.com> wrote:
>
> is_boot_sector_ntfs() checks the boot sector's sectors_per_cluster field
> with a range test that rejects 0x81..0xf3 but accepts 0 and other
> non-power-of-two counts. A zero value reaches parse_ntfs_boot_sector():
>
> sectors_per_cluster_bits = ffs(sectors_per_cluster) - 1;
> ...
> vol->cluster_size = vol->sector_size << sectors_per_cluster_bits;
>
> ffs(0) is 0, so sectors_per_cluster_bits becomes (unsigned)-1 and the
> shift is undefined:
>
> UBSAN: shift-out-of-bounds in fs/ntfs/super.c:673:39
> shift exponent 4294967295 is too large for 32-bit type 'int'
>
> This change rejects any non-power-of-two value, since it feeds the
> aforementioned shift via ffs() - 1, which only yields the correct shift for a
> power of two.
>
> Fixes: 6251f0b0de7d ("ntfs: update super block operations")
> Assisted-by: Claude:claude-opus-4-8
> Signed-off-by: Dennis Tighe <dennis.tighe@gmail.com>
Applied it to #ntfs-next.
Thanks!
prev parent reply other threads:[~2026-08-26 11:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 5:09 Dennis Tighe
2026-08-26 11:41 ` Namjae Jeon [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=CAKYAXd8YDpTrru8aB343K-22hReS3_Hqa3JuEbxumaMPdLetTA@mail.gmail.com \
--to=linkinjeon@kernel.org \
--cc=dennis.tighe@gmail.com \
--cc=hyc.lee@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@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
all inboxes | Powered by JetHome®