[ALSA] Fix a deadlock in snd-rtctimer
authorTakashi Iwai <tiwai@suse.de>
Wed, 5 Jul 2006 15:16:58 +0000 (17:16 +0200)
committerJaroslav Kysela <perex@suse.cz>
Wed, 12 Jul 2006 18:08:06 +0000 (20:08 +0200)
Fix a 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>
sound/core/timer.c

index 78199f58b93a7daf6fc9a53e5f7b1190d977b71a..0a984e881c1089ee68ac4ca11c8ad98a82d0902e 100644 (file)
@@ -628,8 +628,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 */
@@ -649,7 +650,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);
 }
 
 /*