ALSA: Fix a deadlock in snd-rtctimer
authorTakashi Iwai <tiwai@suse.de>
Tue, 5 Sep 2006 19:37:16 +0000 (21:37 +0200)
committerAdrian Bunk <bunk@stusta.de>
Tue, 5 Sep 2006 19:37:16 +0000 (21:37 +0200)
Fix an occasional deadlock occuring with snd-rtctimer driver,
added irqsave to the lock in tasklet (ALSA bug#952).

Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Signed-off-by: Adrian Bunk <bunk@stusta.de>
sound/core/timer.c

index 2425b971b240b01387a00f0cb0b3df08b51941bb..c7670f5c44895521addfd01d28f25fd9a24667df 100644 (file)
@@ -627,8 +627,9 @@ static void snd_timer_tasklet(unsigned long arg)
        struct snd_timer_instance *ti;
        struct list_head *p;
        unsigned long resolution, ticks;
+       unsigned long flags;
 
-       spin_lock(&timer->lock);
+       spin_lock_irqsave(&timer->lock, flags);
        /* now process all callbacks */
        while (!list_empty(&timer->sack_list_head)) {
                p = timer->sack_list_head.next;         /* get first item */
@@ -648,7 +649,7 @@ static void snd_timer_tasklet(unsigned long arg)
                spin_lock(&timer->lock);
                ti->flags &= ~SNDRV_TIMER_IFLG_CALLBACK;
        }
-       spin_unlock(&timer->lock);
+       spin_unlock_irqrestore(&timer->lock, flags);
 }
 
 /*