Skip to contentSkip to conversation

ASoC: Fix early event callback list iteration

PATCH In review Lars-Peter Clausen 2 participants 2 messages May 22, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ASoC: Fix early event callback list iteration

The power_list field is used when adding a widget to a power sequence list. Use the same field when iterating the list using list_for_each_entry, otherwise we'll see undefined behavior.

---
 sound/soc/soc-dapm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/soc/soc-dapm.c +2 -2
index 071579b..3507346 100644
@@ -1738,11 +1738,11 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
 					&async_domain);
 	async_synchronize_full_domain(&async_domain);
 
-	list_for_each_entry(w, &down_list, list) {
+	list_for_each_entry(w, &down_list, power_list) {
 		dapm_seq_check_event(dapm, w, SND_SOC_DAPM_WILL_PMD);
 	}
 
-	list_for_each_entry(w, &up_list, list) {
+	list_for_each_entry(w, &up_list, power_list) {
 		dapm_seq_check_event(dapm, w, SND_SOC_DAPM_WILL_PMU);
 	}
 
Signature · 1 line
1.8.2.1
maintainer
#1 lore raw
Quoted 3 lines · Lars-Peter Clausen

The power_list field is used when adding a widget to a power sequence list. Use the same field when iterating the list using list_for_each_entry, otherwise we'll see undefined behavior.

Gah, I had noticed occasional errors but hadn't seen them often enough to reproduce reliably in my testing. Thanks!