summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2021-06-02 13:38:23 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-06-10 13:24:06 +0200
commitdb6e9d1cc260e3d333221d05b74029793742d5dc (patch)
tree8534c821b7f4e81ad9ccf3a05a1caf8906196018
parentcb7bb81ac98d806ee47fc0ab3849db22df27471f (diff)
downloadlinux-db6e9d1cc260e3d333221d05b74029793742d5dc.tar.gz
linux-db6e9d1cc260e3d333221d05b74029793742d5dc.tar.bz2
linux-db6e9d1cc260e3d333221d05b74029793742d5dc.zip
ALSA: timer: Fix master timer notification
commit 9c1fe96bded935369f8340c2ac2e9e189f697d5d upstream. 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. Reported-by: syzbot+d102fa5b35335a7e544e@syzkaller.appspotmail.com Reviewed-by: Jaroslav Kysela <perex@perex.cz> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/000000000000e5560e05c3bd1d63@google.com Link: https://lore.kernel.org/r/20210602113823.23777-1-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--sound/core/timer.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index b5dc51030316..b4fe1324b56c 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -500,9 +500,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 */