public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 2/2] ALSA: timer: Info leak in snd_timer_user_tinterrupt()
@ 2017-03-31 15:22 Dan Carpenter
  2017-03-31 15:28 ` Takashi Iwai
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Carpenter @ 2017-03-31 15:22 UTC (permalink / raw)
  To: Jaroslav Kysela, Kangjie Lu
  Cc: kernel-janitors, alsa-devel, Alexandre Belloni, Takashi Iwai

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.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/sound/core/timer.c b/sound/core/timer.c
index 8b9e7943a83b..2f836ca09860 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -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;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH 2/2] ALSA: timer: Info leak in snd_timer_user_tinterrupt()
  2017-03-31 15:22 [PATCH 2/2] ALSA: timer: Info leak in snd_timer_user_tinterrupt() Dan Carpenter
@ 2017-03-31 15:28 ` Takashi Iwai
  0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2017-03-31 15:28 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Kangjie Lu, Jaroslav Kysela, alsa-devel, Alexandre Belloni,
	kernel-janitors

On Fri, 31 Mar 2017 17:22:23 +0200,
Dan Carpenter wrote:
> 
> 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.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-03-31 15:28 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-31 15:22 [PATCH 2/2] ALSA: timer: Info leak in snd_timer_user_tinterrupt() Dan Carpenter
2017-03-31 15:28 ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox