[ALSA] Fix possible races in timer callbacks
Fix possible races in timer callbacks.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index a8a6a5c..4eddb51 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -609,8 +609,9 @@
static void snd_korg1212_timer_func(unsigned long data)
{
struct snd_korg1212 *korg1212 = (struct snd_korg1212 *) data;
+ unsigned long flags;
- spin_lock(&korg1212->lock);
+ spin_lock_irqsave(&korg1212->lock, flags);
if (korg1212->sharedBufferPtr->cardCommand == 0) {
/* ack'ed */
korg1212->stop_pending_cnt = 0;
@@ -632,7 +633,7 @@
stateName[korg1212->cardState]);
}
}
- spin_unlock(&korg1212->lock);
+ spin_unlock_irqrestore(&korg1212->lock, flags);
}
static int snd_korg1212_TurnOnIdleMonitor(struct snd_korg1212 *korg1212)