Re: [PATCH] exfat: reject cluster counts above the exFAT maximum

From: Namjae Jeon

Date: Sun Nov 29 2026 - 19:07:59 EST


On Sun, Nov 29, 2026 at 10:53 PM Andrew Stellman
<bugs@xxxxxxxxxxxxxxxxxxx> wrote:
>
> From: Andrew Stellman <astellman@xxxxxxxxxxxxxxxxxxx>
>
> exfat_read_boot_sector() adds the two reserved clusters to the on-disk
> ClusterCount without a range check, so a ClusterCount of 0xffffffff
> wraps num_clusters to 1, and the FAT length check that follows uses the
> wrapped value. With a crafted 64 MiB image, a read-only mount got as
> far as the allocation bitmap size check, which reported a required size
> of 536870912 bytes, before failing.
>
> Reject a ClusterCount above EXFAT_MAX_NUM_CLUSTER before adding the
> reserved clusters. This changes behavior for images with a
> ClusterCount above that limit: the mount is now rejected at boot-sector
> validation.
>
> Tested in an arm64 QEMU guest with KASAN: the crafted image now fails
> with "bogus cluster count", and an ordinary image mounts with and
> without the patch.
>
> The issue was found by Claude running Quality Playbook, an LLM-driven
> code review tool:
> https://github.com/andrewstellman/quality-playbook
> The fix was drafted with OpenAI GPT-6 (Codex) and this changelog with
> Claude Opus 5.5, and both were reviewed by me.
>
> Fixes: 719c1e182916 ("exfat: add super block operations")
> Signed-off-by: Andrew Stellman <astellman@xxxxxxxxxxxxxxxxxxx>
Applied it to #dev.
Thanks!