Skip to contentSkip to conversation

ALSA: timer: Info leak in snd_timer_user_tinterrupt()

PATCH Applied Dan Carpenter 2 participants 2 messages Mar 31, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 2/2 ALSA: timer: Info leak in snd_timer_user_tinterrupt()

The "r1" struct has memory holes. We clear it with memset on one path where it is used but not the other. Let's just memset it at the start of the function so it's always safe.

sound/core/timer.c +1 -1
index 8b9e7943a83b..2f836ca09860 100644
@@ -1277,6 +1277,7 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,
 	struct timespec tstamp;
 	int prev, append = 0;
 
+	memset(&r1, 0, sizeof(r1));
 	memset(&tstamp, 0, sizeof(tstamp));
 	spin_lock(&tu->qlock);
 	if ((tu->filter & ((1 << SNDRV_TIMER_EVENT_RESOLUTION) |
@@ -1292,7 +1293,6 @@ static void snd_timer_user_tinterrupt(struct snd_timer_instance *timeri,
 	}
 	if ((tu->filter & (1 << SNDRV_TIMER_EVENT_RESOLUTION)) &&
 	    tu->last_resolution != resolution) {
-		memset(&r1, 0, sizeof(r1));
 		r1.event = SNDRV_TIMER_EVENT_RESOLUTION;
 		r1.tstamp = tstamp;
 		r1.val = resolution;
Applied
#1 lore raw
Quoted 6 lines · Dan Carpenter

The "r1" struct has memory holes. We clear it with memset on one path where it is used but not the other. Let's just memset it at the start of the function so it's always safe.

Applied, thanks.

Takashi