Skip to content

Commit 94094c8

Browse files
committed
ALSA: timer - Add NULL-check for invalid slave timer
Just to be sure. Signed-off-by: Takashi Iwai <tiwai@suse.de>
1 parent 0584ffa commit 94094c8

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

‎sound/core/timer.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,8 @@ int snd_timer_close(struct snd_timer_instance *timeri)
328328
mutex_unlock(&register_mutex);
329329
} else {
330330
timer = timeri->timer;
331+
if (snd_BUG_ON(!timer))
332+
goto out;
331333
/* wait, until the active callback is finished */
332334
spin_lock_irq(&timer->lock);
333335
while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
@@ -353,6 +355,7 @@ int snd_timer_close(struct snd_timer_instance *timeri)
353355
}
354356
mutex_unlock(&register_mutex);
355357
}
358+
out:
356359
if (timeri->private_free)
357360
timeri->private_free(timeri);
358361
kfree(timeri->owner);

0 commit comments

Comments
 (0)