All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_new_dai
@ 2019-03-21 10:11 Pankaj Bharadiya
  2019-03-21 12:31 ` Mark Brown
  0 siblings, 1 reply; 5+ messages in thread
From: Pankaj Bharadiya @ 2019-03-21 10:11 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel
  Cc: linux-kernel, pankaj.laxminarayan.bharadiya

In case of single config, w_param_text is NULL.
In snd_soc_dapm_new_control_unlocked() call failure case, it will end
up calling snd_soc_dapm_free_kcontrol() unconditionally and result in
NULL pointer dereference.

Signed-off-by: Pankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>
---
 sound/soc/soc-dapm.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1ec06ef..ba6cb37 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -4094,8 +4094,9 @@ snd_soc_dapm_new_dai(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd,
 
 outfree_kcontrol_news:
 	devm_kfree(card->dev, (void *)template.kcontrol_news);
-	snd_soc_dapm_free_kcontrol(card, &private_value,
-				   rtd->dai_link->num_params, w_param_text);
+	if (w_param_text)
+		snd_soc_dapm_free_kcontrol(card, &private_value,
+				rtd->dai_link->num_params, w_param_text);
 param_fail:
 	devm_kfree(card->dev, link_name);
 	return ERR_PTR(ret);
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2019-03-21 16:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-21 10:11 [PATCH] ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_new_dai Pankaj Bharadiya
2019-03-21 12:31 ` Mark Brown
2019-03-21 13:59   ` Pierre-Louis Bossart
2019-03-21 14:09     ` [alsa-devel] " Mark Brown
2019-03-21 16:31       ` Bharadiya,Pankaj

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.