summaryrefslogtreecommitdiffstats
path: root/sound/soc/soc-topology.c
diff options
context:
space:
mode:
authorChristophe JAILLET <christophe.jaillet@wanadoo.fr>2017-09-14 22:44:12 +0200
committerMark Brown <broonie@kernel.org>2017-09-14 14:13:03 -0700
commit6d5574ed5c8b1a1f31fcbdab5d26e15533c442ca (patch)
tree84b4b6309f3c400ef5a169b0d6800ec8e04dfd8c /sound/soc/soc-topology.c
parentf5fd4a67bef5f2c5c2c9eb0cb2900e12d192ae23 (diff)
downloadop-kernel-dev-6d5574ed5c8b1a1f31fcbdab5d26e15533c442ca.zip
op-kernel-dev-6d5574ed5c8b1a1f31fcbdab5d26e15533c442ca.tar.gz
ASoC: topology: Fix a potential NULL pointer dereference in 'soc_tplg_dapm_widget_denum_create()'
if 'se = kzalloc()' fails in the 'for' loop, we will branch to 'err'. But in this case, 'kc[i].private_value' will still be NULL. A NULL pointer dereference will then occur is the error handling path. In such a case, it is safe to just 'continue' in order to skip this entry and free the other ones. Fixes: 1a7dd6e2f192 ("ASoC: topology: Allow a widget to have multiple enum controls") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-topology.c')
-rw-r--r--sound/soc/soc-topology.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/sound/soc/soc-topology.c b/sound/soc/soc-topology.c
index dd471d2..2499b54 100644
--- a/sound/soc/soc-topology.c
+++ b/sound/soc/soc-topology.c
@@ -1378,6 +1378,9 @@ err_se:
for (; i >= 0; i--) {
/* free values and texts */
se = (struct soc_enum *)kc[i].private_value;
+ if (!se)
+ continue;
+
kfree(se->dobj.control.dvalues);
for (j = 0; j < ec->items; j++)
kfree(se->dobj.control.dtexts[j]);
OpenPOWER on IntegriCloud