From: "Péter Ujfalusi" <peter.ujfalusi@linux.intel.com>
To: Tavian Barnes <tavianator@tavianator.com>
Cc: linux-sound@vger.kernel.org, Liam Girdwood <lgirdwood@gmail.com>,
Bard Liao <yung-chuan.liao@linux.intel.com>,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
Daniel Baluta <daniel.baluta@nxp.com>,
Kai Vehmanen <kai.vehmanen@linux.intel.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.dev>,
Mark Brown <broonie@kernel.org>, Jaroslav Kysela <perex@perex.cz>,
Takashi Iwai <tiwai@suse.com>,
Peter Zijlstra <peterz@infradead.org>,
sound-open-firmware@alsa-project.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] ASoC: SOF: Intel: hda: Fix UAF when reloading module
Date: Thu, 8 May 2025 08:49:59 +0300 [thread overview]
Message-ID: <71d1f2a1-e2ab-4327-bc6a-ff0aa7dbc19c@linux.intel.com> (raw)
In-Reply-To: <CABg4E-moQf62Mm+Dv62yLwQaHfKHcrH54Gud1vj6bn6D7mvKJw@mail.gmail.com>
On 07/05/2025 20:06, Tavian Barnes wrote:
>>> - hda_mach = snd_soc_acpi_intel_hda_machines;
>>> + /* make a copy so we can modify it below */
>>> + hda_mach = devm_kmemdup(sdev->dev,
>>> + snd_soc_acpi_intel_hda_machines,
>>> + sizeof(*hda_mach),
>>> + GFP_KERNEL);
>>
>> We need to copy 2x the size as the snd_soc_acpi_intel_hda_machines[] has
>> two entries, the second is the sentinel (all 0).
>
> Do we? I recognize that snd_soc_acpi_intel_hda_machines is an array,
> but I don't see anywhere that hda_mach or *mach are used as an array,
> at least in hda.c.
>
> I'm no expert though, if we need the sentinel I can send a v4. Thanks
> for the review!
Yes, we need to preserve the sentinel. When dealing with the
snd_soc_acpi_mach all code looks for the sentinel at the end to break
the loops. The size of the arrays are unknown outside where they are
defined.
--
Péter
prev parent reply other threads:[~2025-05-08 5:48 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-05-07 15:10 [PATCH v3] ASoC: SOF: Intel: hda: Fix UAF when reloading module Tavian Barnes
2025-05-07 15:29 ` Péter Ujfalusi
2025-05-07 17:06 ` Tavian Barnes
2025-05-08 5:49 ` Péter Ujfalusi [this message]
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=71d1f2a1-e2ab-4327-bc6a-ff0aa7dbc19c@linux.intel.com \
--to=peter.ujfalusi@linux.intel.com \
--cc=broonie@kernel.org \
--cc=daniel.baluta@nxp.com \
--cc=kai.vehmanen@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=peterz@infradead.org \
--cc=pierre-louis.bossart@linux.dev \
--cc=ranjani.sridharan@linux.intel.com \
--cc=sound-open-firmware@alsa-project.org \
--cc=tavianator@tavianator.com \
--cc=tiwai@suse.com \
--cc=yung-chuan.liao@linux.intel.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