Skip to contentSkip to conversation

ALSA: timer: Fix master timer notification

PATCH RESEND New Takashi Iwai 1 participant 1 message Jun 2, 2021 Sound

lore
Share & tools
lore
#0 lore raw

PATCH RESEND 1/1 ALSA: timer: Fix master timer notification

snd_timer_notify1() calls the notification to each slave for a master event, but it passes a wrong event number. It should be +10 offset, corresponding to SNDRV_TIMER_EVENT_MXXX, but it's incorrectly with +100 offset. Casually this was spotted by UBSAN check via syzkaller.

---
 sound/core/timer.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
sound/core/timer.c +2 -1
index 6898b1ac0d7f..92b7008fcdb8 100644
@@ -520,9 +520,10 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event)
 		return;
 	if (timer->hw.flags & SNDRV_TIMER_HW_SLAVE)
 		return;
+	event += 10; /* convert to SNDRV_TIMER_EVENT_MXXX */
 	list_for_each_entry(ts, &ti->slave_active_head, active_list)
 		if (ts->ccallback)
-			ts->ccallback(ts, event + 100, &tstamp, resolution);
+			ts->ccallback(ts, event, &tstamp, resolution);
 }
 
 /* start/continue a master timer */
Signature · 1 line
2.26.2