public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: "Dan Carpenter" <dan.carpenter@oracle.com>
Cc: "Jaroslav Kysela" <perex@perex.cz>, <alsa-devel@alsa-project.org>,
	<kernel-janitors@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [patch] ALSA: isa/wavefront: prevent some out of bound writes
Date: Sun, 08 May 2016 11:39:56 +0200	[thread overview]
Message-ID: <s5heg9csxar.wl-tiwai@suse.de> (raw)
In-Reply-To: <20160504062737.GI22064@mwanda>

On Wed, 04 May 2016 08:27:37 +0200,
Dan Carpenter wrote:
> 
> "header->number" can be up to USHRT_MAX and it comes from the ioctl so
> it needs to be capped.
> 
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Applied, thanks.


Takashi

> 
> diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
> index 69f76ff..718d5e3 100644
> --- a/sound/isa/wavefront/wavefront_synth.c
> +++ b/sound/isa/wavefront/wavefront_synth.c
> @@ -785,6 +785,9 @@ wavefront_send_patch (snd_wavefront_t *dev, wavefront_patch_info *header)
>  	DPRINT (WF_DEBUG_LOAD_PATCH, "downloading patch %d\n",
>  				      header->number);
>  
> +	if (header->number >= ARRAY_SIZE(dev->patch_status))
> +		return -EINVAL;
> +
>  	dev->patch_status[header->number] |= WF_SLOT_FILLED;
>  
>  	bptr = buf;
> @@ -809,6 +812,9 @@ wavefront_send_program (snd_wavefront_t *dev, wavefront_patch_info *header)
>  	DPRINT (WF_DEBUG_LOAD_PATCH, "downloading program %d\n",
>  		header->number);
>  
> +	if (header->number >= ARRAY_SIZE(dev->prog_status))
> +		return -EINVAL;
> +
>  	dev->prog_status[header->number] = WF_SLOT_USED;
>  
>  	/* XXX need to zero existing SLOT_USED bit for program_status[i]
> @@ -898,6 +904,9 @@ wavefront_send_sample (snd_wavefront_t *dev,
>  		header->number = x;
>  	}
>  
> +	if (header->number >= WF_MAX_SAMPLE)
> +		return -EINVAL;
> +
>  	if (header->size) {
>  
>  		/* XXX it's a debatable point whether or not RDONLY semantics
> 

      reply	other threads:[~2016-05-08  9:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-04  6:27 [patch] ALSA: isa/wavefront: prevent some out of bound writes Dan Carpenter
2016-05-08  9:39 ` 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=s5heg9csxar.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=dan.carpenter@oracle.com \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    /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