aboutsummaryrefslogtreecommitdiffstats
path: root/sound/core
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2005-11-18 12:52:14 -0500
committerJaroslav Kysela <perex@suse.cz>2006-01-03 06:29:08 -0500
commitb32425ac93370e1ba5556110e662f896b2e143b3 (patch)
treec5837ee90c16d2aa358e399f2ad79ca4eb770e94 /sound/core
parent2eb061f41cf74f829bfe90a9c79c765172be9f0b (diff)
[ALSA] Fix possible races in timer callbacks
Fix possible races in timer callbacks. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/core')
-rw-r--r--sound/core/timer.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 74637cef6d2c..6aad411dd7b8 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -662,12 +662,13 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
662 struct snd_timer_instance *ti, *ts; 662 struct snd_timer_instance *ti, *ts;
663 unsigned long resolution, ticks; 663 unsigned long resolution, ticks;
664 struct list_head *p, *q, *n, *ack_list_head; 664 struct list_head *p, *q, *n, *ack_list_head;
665 unsigned long flags;
665 int use_tasklet = 0; 666 int use_tasklet = 0;
666 667
667 if (timer == NULL) 668 if (timer == NULL)
668 return; 669 return;
669 670
670 spin_lock(&timer->lock); 671 spin_lock_irqsave(&timer->lock, flags);
671 672
672 /* remember the current resolution */ 673 /* remember the current resolution */
673 if (timer->hw.c_resolution) 674 if (timer->hw.c_resolution)
@@ -752,7 +753,7 @@ void snd_timer_interrupt(struct snd_timer * timer, unsigned long ticks_left)
752 753
753 /* do we have any slow callbacks? */ 754 /* do we have any slow callbacks? */
754 use_tasklet = !list_empty(&timer->sack_list_head); 755 use_tasklet = !list_empty(&timer->sack_list_head);
755 spin_unlock(&timer->lock); 756 spin_unlock_irqrestore(&timer->lock, flags);
756 757
757 if (use_tasklet) 758 if (use_tasklet)
758 tasklet_hi_schedule(&timer->task_queue); 759 tasklet_hi_schedule(&timer->task_queue);