ASoC: topology: Check widget kcontrols before deref
Validate the topology input before we dereference the pointer. Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com> Signed-off-by: Mark Brown <broonie@kernel.org>hifive-unleashed-5.1
parent
feb12f0cd8
commit
f53c4c20d6
|
@ -513,7 +513,7 @@ static void remove_widget(struct snd_soc_component *comp,
|
||||||
*/
|
*/
|
||||||
if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) {
|
if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) {
|
||||||
/* enumerated widget mixer */
|
/* enumerated widget mixer */
|
||||||
for (i = 0; i < w->num_kcontrols; i++) {
|
for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
|
||||||
struct snd_kcontrol *kcontrol = w->kcontrols[i];
|
struct snd_kcontrol *kcontrol = w->kcontrols[i];
|
||||||
struct soc_enum *se =
|
struct soc_enum *se =
|
||||||
(struct soc_enum *)kcontrol->private_value;
|
(struct soc_enum *)kcontrol->private_value;
|
||||||
|
@ -530,7 +530,7 @@ static void remove_widget(struct snd_soc_component *comp,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* volume mixer or bytes controls */
|
/* volume mixer or bytes controls */
|
||||||
for (i = 0; i < w->num_kcontrols; i++) {
|
for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
|
||||||
struct snd_kcontrol *kcontrol = w->kcontrols[i];
|
struct snd_kcontrol *kcontrol = w->kcontrols[i];
|
||||||
|
|
||||||
if (dobj->widget.kcontrol_type
|
if (dobj->widget.kcontrol_type
|
||||||
|
|
Loading…
Reference in New Issue