public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol
@ 2019-03-22 12:30 Pankaj Bharadiya
  2019-03-22 14:43 ` [alsa-devel] " Pierre-Louis Bossart
  2019-03-25 12:22 ` Applied "ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol" to the asoc tree Mark Brown
  0 siblings, 2 replies; 3+ messages in thread
From: Pankaj Bharadiya @ 2019-03-22 12:30 UTC (permalink / raw)
  To: lgirdwood, broonie, perex, tiwai, alsa-devel
  Cc: linux-kernel, pankaj.laxminarayan.bharadiya

w_text_param can be NULL and it is being dereferenced without checking.
Add the missing sanity check to prevent  NULL pointer dereference.

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

diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1ec06ef..67b032c 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -3957,6 +3957,10 @@ snd_soc_dapm_free_kcontrol(struct snd_soc_card *card,
 	int count;
 
 	devm_kfree(card->dev, (void *)*private_value);
+
+	if (!w_param_text)
+		return;
+
 	for (count = 0 ; count < num_params; count++)
 		devm_kfree(card->dev, (void *)w_param_text[count]);
 	devm_kfree(card->dev, w_param_text);
-- 
2.7.4


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

end of thread, other threads:[~2019-03-25 12:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-03-22 12:30 [PATCH] ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol Pankaj Bharadiya
2019-03-22 14:43 ` [alsa-devel] " Pierre-Louis Bossart
2019-03-25 12:22 ` Applied "ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol" to the asoc tree Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox