From b32425ac93370e1ba5556110e662f896b2e143b3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Fri, 18 Nov 2005 18:52:14 +0100 Subject: [ALSA] Fix possible races in timer callbacks Fix possible races in timer callbacks. Signed-off-by: Takashi Iwai --- sound/synth/emux/emux_synth.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'sound/synth/emux/emux_synth.c') diff --git a/sound/synth/emux/emux_synth.c b/sound/synth/emux/emux_synth.c index c387a83a655e..24705d15ebd8 100644 --- a/sound/synth/emux/emux_synth.c +++ b/sound/synth/emux/emux_synth.c @@ -205,9 +205,10 @@ void snd_emux_timer_callback(unsigned long data) { struct snd_emux *emu = (struct snd_emux *) data; struct snd_emux_voice *vp; + unsigned long flags; int ch, do_again = 0; - spin_lock(&emu->voice_lock); + spin_lock_irqsave(&emu->voice_lock, flags); for (ch = 0; ch < emu->max_voices; ch++) { vp = &emu->voices[ch]; if (vp->state == SNDRV_EMUX_ST_PENDING) { @@ -225,7 +226,7 @@ void snd_emux_timer_callback(unsigned long data) emu->timer_active = 1; } else emu->timer_active = 0; - spin_unlock(&emu->voice_lock); + spin_unlock_irqrestore(&emu->voice_lock, flags); } /* -- cgit v1.2.3