提交 9314e44f 编写于 作者: A Andrew Gabbasov 提交者: Takashi Iwai

ALSA: aloop: Avoid unexpected timer event callback tasklets

loopback_snd_timer_close_cable() function waits until all
scheduled tasklets are completed, but the timer is closed after that
and can generate more event callbacks, scheduling new tasklets,
that will not be synchronized with cable closing.
Move tasklet_kill() call to be executed after snd_timer_close()
call to avoid such case.

Fixes: 26c53379 ("ALSA: aloop: Support selection of snd_timer instead of jiffies")
Signed-off-by: NAndrew Gabbasov <andrew_gabbasov@mentor.com>
Link: https://lore.kernel.org/r/20191122175218.17187-2-andrew_gabbasov@mentor.comSigned-off-by: NTakashi Iwai <tiwai@suse.de>
上级 c037239c
...@@ -302,15 +302,16 @@ static int loopback_snd_timer_close_cable(struct loopback_pcm *dpcm) ...@@ -302,15 +302,16 @@ static int loopback_snd_timer_close_cable(struct loopback_pcm *dpcm)
if (!cable->snd_timer.instance) if (!cable->snd_timer.instance)
return 0; return 0;
/* wait till drain tasklet has finished if requested */
tasklet_kill(&cable->snd_timer.event_tasklet);
/* will only be called from free_cable() when other stream was /* will only be called from free_cable() when other stream was
* already closed. Other stream cannot be reopened as long as * already closed. Other stream cannot be reopened as long as
* loopback->cable_lock is locked. Therefore no need to lock * loopback->cable_lock is locked. Therefore no need to lock
* cable->lock; * cable->lock;
*/ */
snd_timer_close(cable->snd_timer.instance); snd_timer_close(cable->snd_timer.instance);
/* wait till drain tasklet has finished if requested */
tasklet_kill(&cable->snd_timer.event_tasklet);
snd_timer_instance_free(cable->snd_timer.instance); snd_timer_instance_free(cable->snd_timer.instance);
memset(&cable->snd_timer, 0, sizeof(cable->snd_timer)); memset(&cable->snd_timer, 0, sizeof(cable->snd_timer));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册