[alsa-devel] [PATCH 2/2] ALSA: timer: Assure timer resolution access always locked

Takashi Iwai tiwai at suse.de
Thu May 17 10:46:33 CEST 2018


On Thu, 17 May 2018 00:10:48 +0200,
Takashi Iwai wrote:
> 
> @@ -438,19 +438,24 @@ static unsigned long snd_timer_hw_resolution(struct snd_timer *timer)
>  unsigned long snd_timer_resolution(struct snd_timer_instance *timeri)
>  {
>  	struct snd_timer * timer;
> +	unsigned long ret = 0;
> +	unsigned long flags;
>  
>  	if (timeri == NULL)
>  		return 0;
>  	timer = timeri->timer;
> -	if (timer)
> -		return snd_timer_hw_resolution(timer);
> +	if (timer) {
> +		spin_lock_irqsave(&timer->lock, flags);
> +		ret = snd_timer_hw_resolution(timer);
> +		spin_unlock_irqrestore(&timer->lock, flags);
> +	}
>  	return 0;

This must be return ret, of course.
Will resend v2 series addressing this.


Takashi


More information about the Alsa-devel mailing list