public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: walter harms <wharms@bfs.de>
Cc: alsa-devel@alsa-project.org, Takashi Iwai <tiwai@suse.de>,
	kernel-janitors@vger.kernel.org,
	Vinod Koul <vinod.koul@intel.com>, Jeeja KP <jeeja.kp@intel.com>,
	Namarta Kohli <namartax.kohli@intel.com>
Subject: Re: [patch] ALSA: compress: info leak in snd_compr_get_caps()
Date: Sun, 21 Apr 2013 16:39:06 +0000	[thread overview]
Message-ID: <20130421163906.GL6638@mwanda> (raw)
In-Reply-To: <5173D029.10806@bfs.de>

On Sun, Apr 21, 2013 at 01:40:25PM +0200, walter harms wrote:
> 
> 
> Am 21.04.2013 13:07, schrieb Dan Carpenter:
> > If the ->get_caps() function doesn't clear the buffer then there would
> > stack information leaked to userspace.  For example,
> > soc_compr_get_caps() can return success without clearing the buffer.
> > 
> > Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> > ---
> > Perhaps the soc_compr_get_caps() function should return an error code
> > if the platform->driver->compr_ops is NULL.  I'm not sure about that,
> > and it's a separate issue anyway.
> > 
> > diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
> > index c84abc8..8d3190a 100644
> > --- a/sound/core/compress_offload.c
> > +++ b/sound/core/compress_offload.c
> > @@ -375,6 +375,7 @@ snd_compr_get_caps(struct snd_compr_stream *stream, unsigned long arg)
> >  	if (!stream->ops->get_caps)
> >  		return -ENXIO;
> >  
> > +	memset(&caps, 0, sizeof(caps));
> >  	retval = stream->ops->get_caps(stream, &caps);
> >  	if (retval)
> >  		goto out;
> > --
> 
> IMHO this should be done in get_caps() as it will manipulate the entries.
> or is there a special reason to have it here ?


There isn't a get_caps() function.  It's a pointer to many
functions.  It's safer to do it here where it can be audited
by static analisys.  It's cleaner to do it once instead of many
times.

regards,
dan carpenter


  reply	other threads:[~2013-04-21 16:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-21 11:07 [patch] ALSA: compress: info leak in snd_compr_get_caps() Dan Carpenter
2013-04-21 11:40 ` walter harms
2013-04-21 16:39   ` Dan Carpenter [this message]
2013-04-22  8:42 ` Takashi Iwai
2013-04-22  8:50   ` Vinod Koul

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20130421163906.GL6638@mwanda \
    --to=dan.carpenter@oracle.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=jeeja.kp@intel.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=namartax.kohli@intel.com \
    --cc=tiwai@suse.de \
    --cc=vinod.koul@intel.com \
    --cc=wharms@bfs.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox