Skip to content

Commit f730a46

Browse files
Xiaomeng Tongbroonie
authored andcommitted
ASoC: soc-dapm: fix two incorrect uses of list iterator
These two bug are here: list_for_each_entry_safe_continue(w, n, list, power_list); list_for_each_entry_safe_continue(w, n, list, power_list); After the list_for_each_entry_safe_continue() exits, the list iterator will always be a bogus pointer which point to an invalid struct objdect containing HEAD member. The funciton poniter 'w->event' will be a invalid value which can lead to a control-flow hijack if the 'w' can be controlled. The original intention was to continue the outer list_for_each_entry_safe() loop with the same entry if w->event is NULL, but misunderstanding the meaning of list_for_each_entry_safe_continue(). So just add a 'continue;' to fix the bug. Cc: [email protected] Fixes: 163cac0 ("ASoC: Factor out DAPM sequence execution") Signed-off-by: Xiaomeng Tong <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Mark Brown <[email protected]>
1 parent fb6d679 commit f730a46

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

sound/soc/soc-dapm.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1687,8 +1687,7 @@ static void dapm_seq_run(struct snd_soc_card *card,
16871687
switch (w->id) {
16881688
case snd_soc_dapm_pre:
16891689
if (!w->event)
1690-
list_for_each_entry_safe_continue(w, n, list,
1691-
power_list);
1690+
continue;
16921691

16931692
if (event == SND_SOC_DAPM_STREAM_START)
16941693
ret = w->event(w,
@@ -1700,8 +1699,7 @@ static void dapm_seq_run(struct snd_soc_card *card,
17001699

17011700
case snd_soc_dapm_post:
17021701
if (!w->event)
1703-
list_for_each_entry_safe_continue(w, n, list,
1704-
power_list);
1702+
continue;
17051703

17061704
if (event == SND_SOC_DAPM_STREAM_START)
17071705
ret = w->event(w,

0 commit comments

Comments
 (0)