[ALSA] Fix possible races in timer callbacks
[linux-2.6.git] / sound / pci / korg1212 / korg1212.c
index a8a6a5c41a7f57fbf2461de8bfa4afef4ed0f321..4eddb512c12fdb2f3b13d3b644415f4338d008e1 100644 (file)
@@ -609,8 +609,9 @@ static void snd_korg1212_SendStopAndWait(struct snd_korg1212 *korg1212)
 static void snd_korg1212_timer_func(unsigned long data)
 {
         struct snd_korg1212 *korg1212 = (struct snd_korg1212 *) data;
 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;
        if (korg1212->sharedBufferPtr->cardCommand == 0) {
                /* ack'ed */
                korg1212->stop_pending_cnt = 0;
@@ -632,7 +633,7 @@ static void snd_korg1212_timer_func(unsigned long data)
                                           stateName[korg1212->cardState]);
                }
        }
                                           stateName[korg1212->cardState]);
                }
        }
-       spin_unlock(&korg1212->lock);
+       spin_unlock_irqrestore(&korg1212->lock, flags);
 }
 
 static int snd_korg1212_TurnOnIdleMonitor(struct snd_korg1212 *korg1212)
 }
 
 static int snd_korg1212_TurnOnIdleMonitor(struct snd_korg1212 *korg1212)