From: Jerome Brunet <jbrunet@baylibre.com>
To: Samuel Holland <samuel@sholland.org>,
Liam Girdwood <lgirdwood@gmail.com>,
Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>,
Jonathan Corbet <corbet@lwn.net>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
linux-doc@vger.kernel.org
Subject: Re: [alsa-devel] [PATCH 1/4] ASoC: codec2codec: avoid invalid/double-free of pcm runtime
Date: Thu, 13 Feb 2020 09:37:18 +0100 [thread overview]
Message-ID: <1jr1yyannl.fsf@starbuckisacylon.baylibre.com> (raw)
In-Reply-To: <20200213061147.29386-2-samuel@sholland.org>
On Thu 13 Feb 2020 at 07:11, Samuel Holland <samuel@sholland.org> wrote:
> The PCM runtime was freed during PMU in the case that the event hook
> encountered an error. However, it is also unconditionally freed during
> PMD. Avoid a double-free by dropping the call to kfree in the PMU
> hook.
Oh ... Thanks for finding this.
I thought that a widget which has failed PMU would not go through PMD,
but It seems the return value dapm_seq_check_event is not checked.
This brings another question/problem:
A link which has failed in PMU, could try in PMD to hw_free/shutdown a
dai which has not gone through startup/hw_params, right ?
>
> Fixes: a72706ed8208 ("ASoC: codec2codec: remove ephemeral variables")
> Cc: stable@vger.kernel.org
> Signed-off-by: Samuel Holland <samuel@sholland.org>
> ---
> sound/soc/soc-dapm.c | 3 ---
> 1 file changed, 3 deletions(-)
>
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index b6378f025836..935b5375ecc5 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -3888,9 +3888,6 @@ snd_soc_dai_link_event_pre_pmu(struct snd_soc_dapm_widget *w,
> runtime->rate = params_rate(params);
>
> out:
> - if (ret < 0)
> - kfree(runtime);
> -
> kfree(params);
> return ret;
> }
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel
next prev parent reply other threads:[~2020-02-13 8:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-13 6:11 [alsa-devel] [PATCH 0/4] simple-audio-card codec2codec support Samuel Holland
2020-02-13 6:11 ` [alsa-devel] [PATCH 1/4] ASoC: codec2codec: avoid invalid/double-free of pcm runtime Samuel Holland
2020-02-13 8:37 ` Jerome Brunet [this message]
2020-02-13 11:37 ` Mark Brown
2020-02-13 13:37 ` Jerome Brunet
2020-02-13 13:31 ` [alsa-devel] Applied "ASoC: codec2codec: avoid invalid/double-free of pcm runtime" to the asoc tree Mark Brown
2020-02-13 6:11 ` [alsa-devel] [PATCH 2/4] ALSA: pcm: Make snd_pcm_limit_hw_rates take hw directly Samuel Holland
2020-02-13 6:30 ` Takashi Iwai
2020-02-15 3:19 ` Samuel Holland
2020-02-13 6:11 ` [alsa-devel] [PATCH 3/4] ASoC: pcm: Export parameter intersection logic Samuel Holland
2020-02-13 6:11 ` [alsa-devel] [PATCH 4/4] ASoC: simple-card: Add support for codec-to-codec dai_links Samuel Holland
2020-02-13 9:18 ` Jerome Brunet
2020-02-13 11:38 ` Mark Brown
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=1jr1yyannl.fsf@starbuckisacylon.baylibre.com \
--to=jbrunet@baylibre.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=perex@perex.cz \
--cc=robh+dt@kernel.org \
--cc=samuel@sholland.org \
--cc=stable@vger.kernel.org \
--cc=tiwai@suse.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;
as well as URLs for NNTP newsgroup(s).