From: Emanuele Ghidoli <ghidoliemanuele@gmail.com>
To: Kees Cook <kees@kernel.org>, Takashi Iwai <tiwai@suse.de>
Cc: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Emanuele Ghidoli <emanuele.ghidoli@toradex.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
linux-sound@vger.kernel.org, linux-hardening@vger.kernel.org,
linux-kernel@vger.kernel.org, wenst@chromium.org,
angelogioacchino.delregno@collabora.com
Subject: Re: [PATCH] ASoC: soc-core: reset rtd->num_components after allocation
Date: Wed, 11 Nov 2026 11:28:52 +0100 [thread overview]
Message-ID: <a64e2fa1-6670-4018-80b8-b6856709ad5f@gmail.com> (raw)
In-Reply-To: <EAAF07EF-6B11-4EA5-A5AF-A7787CA2F196@kernel.org>
On 11/11/26 06:59, Kees Cook wrote:
>
>
> On November 10, 2026 9:50:08 PM PST, Kees Cook <kees@kernel.org> wrote:
>
> For example, what keeps snd_soc_rtd_add_component() from overflowing that array? If you want to protect the array, add another member, say max_component, and use that for the counter, which gets set at allocation time and protects the array from indexing beyond the actual allocation size.
>
>
Hello Kees,
Mark has already applied the fix to for-7.4 (d00ba321499c). I agree that
your proposal is far better, but the applied patch was meant as the
minimal change to fix the regression.
On your question about what keeps snd_soc_rtd_add_component() from
overflowing the array: nothing, and it already seems possible today.
From an LLM-assisted review of the code: the platform loop in
snd_soc_add_pcm_runtime() adds every component that matches the platform
dai_link_component, while components[] has one entry per
platform. On mt8173, for example, the AFE registers three components on the
same device and the front-end links use it as platform, so four components go
into three entries. The extra store has gone unnoticed in the slab slack, but
with max_components as the counter UBSAN_BOUNDS would report it.
I can't work on a follow-up. If someone picks it up, components[] probably
needs to be sized by the matching components before the counter is switched to
max_components.
Emanuele
next prev parent reply other threads:[~2026-11-11 10:28 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 10:25 [PATCH] ASoC: soc-core: reset rtd->num_components after allocation Emanuele Ghidoli
2026-11-09 11:07 ` Takashi Iwai
2026-11-10 11:47 ` Takashi Iwai
2026-11-11 5:50 ` Kees Cook
2026-11-11 5:59 ` Kees Cook
2026-11-11 10:28 ` Emanuele Ghidoli [this message]
2026-11-12 17:27 ` Kees Cook
2026-11-11 13:09 ` Mark Brown
2026-11-12 17:33 ` Kees Cook
2026-11-10 9:57 ` Jan Remes
2026-11-10 17:45 ` Mark Brown
2026-11-11 10:06 ` Alexander Stein
2026-11-11 12:26 ` Cosmin-Gabriel Tanislav
-- strict thread matches above, loose matches on Subject: below --
2026-11-10 22:01 Rujbin
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=a64e2fa1-6670-4018-80b8-b6856709ad5f@gmail.com \
--to=ghidoliemanuele@gmail.com \
--cc=angelogioacchino.delregno@collabora.com \
--cc=broonie@kernel.org \
--cc=emanuele.ghidoli@toradex.com \
--cc=gustavoars@kernel.org \
--cc=kees@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
--cc=wenst@chromium.org \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.