linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Dan Rosenberg <drosenberg@vsecurity.com>
Cc: perex@perex.cz, alsa-devel@alsa-project.org, security@kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] sound/oss/opl3: validate voice and channel indexes
Date: Wed, 23 Mar 2011 23:04:28 +0100	[thread overview]
Message-ID: <s5h4o6twl1v.wl%tiwai@suse.de> (raw)
In-Reply-To: <1300894977.1968.37.camel@dan>

At Wed, 23 Mar 2011 11:42:57 -0400,
Dan Rosenberg wrote:
> 
> User-controllable indexes for voice and channel values may cause reading
> and writing beyond the bounds of their respective arrays, leading to
> potentially exploitable memory corruption.  Validate these indexes.
> 
> Signed-off-by: Dan Rosenberg <drosenberg@vsecurity.com>
> Cc: stable@kernel.org

Applied now.  Thanks.


Takashi


> ---
>  sound/oss/opl3.c |   15 +++++++++++++--
>  1 files changed, 13 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/oss/opl3.c b/sound/oss/opl3.c
> index 938c48c..e9d443e 100644
> --- a/sound/oss/opl3.c
> +++ b/sound/oss/opl3.c
> @@ -849,6 +849,10 @@ static int opl3_load_patch(int dev, int format, const char __user *addr,
>  
>  static void opl3_panning(int dev, int voice, int value)
>  {
> +
> +	if (voice < 0 || voice >= devc->nr_voice)
> +		return;
> +
>  	devc->voc[voice].panning = value;
>  }
>  
> @@ -1066,8 +1070,15 @@ static int opl3_alloc_voice(int dev, int chn, int note, struct voice_alloc_info
>  
>  static void opl3_setup_voice(int dev, int voice, int chn)
>  {
> -	struct channel_info *info =
> -	&synth_devs[dev]->chn_info[chn];
> +	struct channel_info *info;
> +
> +	if (voice < 0 || voice >= devc->nr_voice)
> +		return;
> +
> +	if (chn < 0 || chn > 15)
> +		return;
> +
> +	info = &synth_devs[dev]->chn_info[chn];
>  
>  	opl3_set_instr(dev, voice, info->pgm_num);
>  
> 
> 
> 

      reply	other threads:[~2011-03-23 22:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 15:42 [PATCH] sound/oss/opl3: validate voice and channel indexes Dan Rosenberg
2011-03-23 22:04 ` Takashi Iwai [this message]

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=s5h4o6twl1v.wl%tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=drosenberg@vsecurity.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=security@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).