From: Takashi Iwai Date: Mon, 8 Feb 2016 16:36:25 +0000 (+0100) Subject: ALSA: timer: Fix wrong instance passed to slave callbacks X-Git-Tag: v4.1.12-92~150^2~212 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=3cdff76f672e65dfc89e0a05654372e447bb696c;p=users%2Fjedix%2Flinux-maple.git ALSA: timer: Fix wrong instance passed to slave callbacks Orabug: 23330850 [ Upstream commit 117159f0b9d392fb433a7871426fad50317f06f7 ] In snd_timer_notify1(), the wrong timer instance was passed for slave ccallback function. This leads to the access to the wrong data when an incompatible master is handled (e.g. the master is the sequencer timer and the slave is a user timer), as spotted by syzkaller fuzzer. This patch fixes that wrong assignment. BugLink: http://lkml.kernel.org/r/CACT4Y+Y_Bm+7epAb=8Wi=AaWd+DYS7qawX52qxdCfOfY49vozQ@mail.gmail.com Reported-by: Dmitry Vyukov Cc: Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin (cherry picked from commit 47eef3475c5f3063fc20e938f2fe24cd84d731aa) Signed-off-by: Dan Duval --- diff --git a/sound/core/timer.c b/sound/core/timer.c index 00e8c5f4de177..4493dc317d437 100644 --- a/sound/core/timer.c +++ b/sound/core/timer.c @@ -422,7 +422,7 @@ static void snd_timer_notify1(struct snd_timer_instance *ti, int event) spin_lock_irqsave(&timer->lock, flags); list_for_each_entry(ts, &ti->slave_active_head, active_list) if (ts->ccallback) - ts->ccallback(ti, event + 100, &tstamp, resolution); + ts->ccallback(ts, event + 100, &tstamp, resolution); spin_unlock_irqrestore(&timer->lock, flags); }