未验证 提交 54f8844e 编写于 作者: R Ranjani Sridharan 提交者: Mark Brown

ASoC: topology: Use the correct dobj to free enum control values and texts

The control values and texts of the enum kcontrol associated
with a widget need to be freed when the widget is removed.
However, both struct snd_soc_dapm_widget and struct soc_enum
contain a dobj member, which resulted in a confusion.
The existing code generates a null pointer dereference by
attempting to free the values and texts from the dobj which
belongs to the widget instead of the dobj belonging to the
enum kcontrol.

The suggested fix is to use the correct dobj member (se->dobj)
of the enum kcontrol.
Signed-off-by: NRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 2e05ddd2
......@@ -482,10 +482,11 @@ static void remove_widget(struct snd_soc_component *comp,
snd_ctl_remove(card, kcontrol);
kfree(dobj->control.dvalues);
/* free enum kcontrol's dvalues and dtexts */
kfree(se->dobj.control.dvalues);
for (j = 0; j < se->items; j++)
kfree(dobj->control.dtexts[j]);
kfree(dobj->control.dtexts);
kfree(se->dobj.control.dtexts[j]);
kfree(se->dobj.control.dtexts);
kfree(se);
kfree(w->kcontrol_news[i].name);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册