Commit 94094c8a authored by Takashi Iwai's avatar Takashi Iwai

ALSA: timer - Add NULL-check for invalid slave timer

Just to be sure.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 0584ffa5
...@@ -328,6 +328,8 @@ int snd_timer_close(struct snd_timer_instance *timeri) ...@@ -328,6 +328,8 @@ int snd_timer_close(struct snd_timer_instance *timeri)
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
} else { } else {
timer = timeri->timer; timer = timeri->timer;
if (snd_BUG_ON(!timer))
goto out;
/* wait, until the active callback is finished */ /* wait, until the active callback is finished */
spin_lock_irq(&timer->lock); spin_lock_irq(&timer->lock);
while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) { while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
...@@ -353,6 +355,7 @@ int snd_timer_close(struct snd_timer_instance *timeri) ...@@ -353,6 +355,7 @@ int snd_timer_close(struct snd_timer_instance *timeri)
} }
mutex_unlock(&register_mutex); mutex_unlock(&register_mutex);
} }
out:
if (timeri->private_free) if (timeri->private_free)
timeri->private_free(timeri); timeri->private_free(timeri);
kfree(timeri->owner); kfree(timeri->owner);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment