Re: [PATCH] exfat: keep FITRIM within the requested range

From: Namjae Jeon

Date: Fri Aug 14 2026 - 10:49:38 EST


On Thu, Aug 13, 2026 at 11:29 PM Yang Wen <anmuxixixi@xxxxxxxxx> wrote:
>
> exfat_find_free_bitmap() searches the entire allocation bitmap and may
> wrap around to its beginning. exfat_trim_fs() does not verify that the
> returned cluster is still within the requested FITRIM range.
>
> As a result, a partial FITRIM operation may discard free clusters outside
> the user-specified range and report a trimmed length larger than the
> requested length.
>
> Validate each returned cluster against the requested range and stop the
> search when it wraps around or passes the range end.
>
> Signed-off-by: Yang Wen <anmuxixixi@xxxxxxxxx>
Applied it to #dev.
Thanks!