summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-dapm.c
diff options
context:
space:
mode:
authorPankaj Bharadiya <pankaj.laxminarayan.bharadiya@intel.com>2019-03-22 18:00:09 +0530
committerMark Brown <broonie@kernel.org>2019-03-25 12:20:15 +0000
commitcacea3a90e211f0c111975535508d446a4a928d2 (patch)
tree6d9b85cb3306ef8345eb28a435a9887f5e2e9ec9 /sound/soc/soc-dapm.c
parent8f71370f4b02730e8c27faf460af7a3586e24e1f (diff)
downloadlinux-cacea3a90e211f0c111975535508d446a4a928d2.tar.bz2
ASoC: dapm: Fix NULL pointer dereference in snd_soc_dapm_free_kcontrol
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> Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-dapm.c')
-rw-r--r--sound/soc/soc-dapm.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 1ec06ef6d161..67b032ca1601 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);