Re: [PATCH v2] ALSA: core: Validate card indices in lookup helpers
From: Takashi Iwai
Date: Wed Nov 18 2026 - 07:52:59 EST
On Tue, 17 Nov 2026 16:39:31 +0100,
Sreeraj S Kurup wrote:
>
> Ensure card indices are within the valid range before accessing
> the card array or lock bitmap in snd_card_ref() and
> snd_card_locked().
>
> This prevents out-of-range indices from causing invalid memory
> accesses in these lookup helpers. It also protects against
> invalid indices passed by existing or future callers.
>
> Warn about invalid card indices and return NULL from
> snd_card_ref() and 0 from snd_card_locked() when an
> invalid card index is supplied.
>
> Signed-off-by: Sreeraj S Kurup <sreekuttan2156239@xxxxxxxxx>
Applied to for-next branch. Thanks.
Takashi