Re: [PATCH] mm/shrinker: avoid out-of-bounds read in set_shrinker_bit()
From: Muchun Song
Date: Sun May 10 2026 - 22:49:44 EST
> On May 11, 2026, at 02:37, David Carlier <devnexen@xxxxxxxxx> wrote:
>
> set_shrinker_bit() reads info->unit[shrinker_id_to_index(shrinker_id)]
> before checking shrinker_id against info->map_nr_max, so an id past the
> currently visible map_nr_max reads past the unit[] array before the
> WARN_ON_ONCE() catches it.
>
> Move the load into the bounded branch.
>
> Fixes: 307bececcd12 ("mm: shrinker: add a secondary array for shrinker_info::{map, nr_deferred}")
> Signed-off-by: David Carlier <devnexen@xxxxxxxxx>
Acked-by: Muchun Song <muchun.song@xxxxxxxxx>
Thanks.