From: Takashi Iwai <tiwai@suse.de>
To: Sreeraj S Kurup <sreekuttan2156239@gmail.com>
Cc: perex@perex.cz, tiwai@suse.de, linux-kernel@vger.kernel.org,
linux-sound@vger.kernel.org
Subject: Re: [PATCH] ALSA: core: Validate card indices in lookup helpers
Date: Tue, 17 Nov 2026 16:03:06 +0100 [thread overview]
Message-ID: <87se0zxzyt.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261117104155.3080-1-sreekuttan2156239@gmail.com>
On Tue, 17 Nov 2026 11:41:54 +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.
>
> 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@gmail.com>
If the value is out of range, it must be a bug in the driver, so this
is worth for putting either WARN_ON() or snd_BUG_ON().
thanks,
Takashi
next prev parent reply other threads:[~2026-11-17 15:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-17 10:41 Sreeraj S Kurup
2026-11-17 15:03 ` Takashi Iwai [this message]
2026-11-17 15:38 ` Sreeraj S Kurup
2026-11-17 15:39 ` [PATCH v2] " Sreeraj S Kurup
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=87se0zxzyt.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=sreekuttan2156239@gmail.com \
/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®