Skip to content

Commit f53c4c2

Browse files
lrgirdwobroonie
authored andcommitted
ASoC: topology: Check widget kcontrols before deref
Validate the topology input before we dereference the pointer. Signed-off-by: Liam Girdwood <[email protected]> Signed-off-by: Mark Brown <[email protected]>
1 parent feb12f0 commit f53c4c2

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

sound/soc/soc-topology.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ static void remove_widget(struct snd_soc_component *comp,
513513
*/
514514
if (dobj->widget.kcontrol_type == SND_SOC_TPLG_TYPE_ENUM) {
515515
/* enumerated widget mixer */
516-
for (i = 0; i < w->num_kcontrols; i++) {
516+
for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
517517
struct snd_kcontrol *kcontrol = w->kcontrols[i];
518518
struct soc_enum *se =
519519
(struct soc_enum *)kcontrol->private_value;
@@ -530,7 +530,7 @@ static void remove_widget(struct snd_soc_component *comp,
530530
}
531531
} else {
532532
/* volume mixer or bytes controls */
533-
for (i = 0; i < w->num_kcontrols; i++) {
533+
for (i = 0; w->kcontrols != NULL && i < w->num_kcontrols; i++) {
534534
struct snd_kcontrol *kcontrol = w->kcontrols[i];
535535

536536
if (dobj->widget.kcontrol_type

0 commit comments

Comments
 (0)