From 94094c8aaeded11f8b99734b9ebdaada20b5f24a Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Mon, 8 Aug 2011 12:28:22 +0200
Subject: ALSA: timer - Add NULL-check for invalid slave timer

Just to be sure.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/core/timer.c | 3 +++
 1 file changed, 3 insertions(+)

(limited to 'sound/core')

diff --git a/sound/core/timer.c b/sound/core/timer.c
index 950eed0c098..67ebf1c21c0 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -328,6 +328,8 @@ int snd_timer_close(struct snd_timer_instance *timeri)
 		mutex_unlock(&register_mutex);
 	} else {
 		timer = timeri->timer;
+		if (snd_BUG_ON(!timer))
+			goto out;
 		/* wait, until the active callback is finished */
 		spin_lock_irq(&timer->lock);
 		while (timeri->flags & SNDRV_TIMER_IFLG_CALLBACK) {
@@ -353,6 +355,7 @@ int snd_timer_close(struct snd_timer_instance *timeri)
 		}
 		mutex_unlock(&register_mutex);
 	}
+ out:
 	if (timeri->private_free)
 		timeri->private_free(timeri);
 	kfree(timeri->owner);
-- 
cgit v1.2.3-70-g09d2