All of lore.kernel.org
 help / color / mirror / Atom feed
From: Samuel Holland <samuel@sholland.org>
To: 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>,
	Jerome Brunet <jbrunet@baylibre.com>
Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org,
	Samuel Holland <samuel@sholland.org>,
	stable@vger.kernel.org
Subject: [PATCH 1/4] ASoC: codec2codec: avoid invalid/double-free of pcm runtime
Date: Thu, 13 Feb 2020 00:11:44 -0600	[thread overview]
Message-ID: <20200213061147.29386-2-samuel@sholland.org> (raw)
In-Reply-To: <20200213061147.29386-1-samuel@sholland.org>

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.

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;
 }
-- 
2.24.1


WARNING: multiple messages have this Message-ID (diff)
From: Samuel Holland <samuel@sholland.org>
To: 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>,
	Jerome Brunet <jbrunet@baylibre.com>
Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org,
	Samuel Holland <samuel@sholland.org>,
	linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: [alsa-devel] [PATCH 1/4] ASoC: codec2codec: avoid invalid/double-free of pcm runtime
Date: Thu, 13 Feb 2020 00:11:44 -0600	[thread overview]
Message-ID: <20200213061147.29386-2-samuel@sholland.org> (raw)
In-Reply-To: <20200213061147.29386-1-samuel@sholland.org>

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.

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;
 }
-- 
2.24.1

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  reply	other threads:[~2020-02-13  6:12 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-13  6:11 [PATCH 0/4] simple-audio-card codec2codec support Samuel Holland
2020-02-13  6:11 ` [alsa-devel] " Samuel Holland
2020-02-13  6:11 ` Samuel Holland [this message]
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
2020-02-13  8:37     ` [alsa-devel] " Jerome Brunet
2020-02-13 11:37     ` Mark Brown
2020-02-13 11:37       ` [alsa-devel] " Mark Brown
2020-02-13 13:37       ` Jerome Brunet
2020-02-13 13:37         ` [alsa-devel] " Jerome Brunet
2020-02-13 13:31   ` Applied "ASoC: codec2codec: avoid invalid/double-free of pcm runtime" to the asoc tree Mark Brown
2020-02-13 13:31     ` [alsa-devel] " Mark Brown
2020-02-13  6:11 ` [PATCH 2/4] ALSA: pcm: Make snd_pcm_limit_hw_rates take hw directly Samuel Holland
2020-02-13  6:11   ` [alsa-devel] " Samuel Holland
2020-02-13  6:30   ` Takashi Iwai
2020-02-13  6:30     ` [alsa-devel] " Takashi Iwai
2020-02-15  3:19     ` Samuel Holland
2020-02-15  3:19       ` [alsa-devel] " Samuel Holland
2020-02-13  6:11 ` [PATCH 3/4] ASoC: pcm: Export parameter intersection logic Samuel Holland
2020-02-13  6:11   ` [alsa-devel] " Samuel Holland
2020-02-13  6:11 ` [PATCH 4/4] ASoC: simple-card: Add support for codec-to-codec dai_links Samuel Holland
2020-02-13  6:11   ` [alsa-devel] " Samuel Holland
2020-02-13  9:18   ` Jerome Brunet
2020-02-13  9:18     ` [alsa-devel] " Jerome Brunet
2020-02-13 11:38     ` Mark Brown
2020-02-13 11:38       ` [alsa-devel] " 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=20200213061147.29386-2-samuel@sholland.org \
    --to=samuel@sholland.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=corbet@lwn.net \
    --cc=devicetree@vger.kernel.org \
    --cc=jbrunet@baylibre.com \
    --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=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 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.