linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Steve Lee <steves.lee@maximintegrated.com>
Cc: lgirdwood@gmail.com, perex@perex.cz, tiwai@suse.com,
	ckeepax@opensource.cirrus.com, geert@linux-m68k.org,
	rf@opensource.wolfsonmicro.com, shumingf@realtek.com,
	srinivas.kandagatla@linaro.org, krzk@kernel.org, dmurphy@ti.com,
	jack.yu@realtek.com, nuno.sa@analog.com,
	linux-kernel@vger.kernel.org, alsa-devel@alsa-project.org,
	ryan.lee.maxim@gmail.com, ryans.lee@maximintegrated.com,
	steves.lee.maxim@gmail.com
Subject: Re: [PATCH] ASoC: max98390: Fix potential crash during param fw loading
Date: Wed, 3 Jun 2020 12:31:45 +0100	[thread overview]
Message-ID: <20200603113145.GC5327@sirena.org.uk> (raw)
In-Reply-To: <20200603111819.5824-1-steves.lee@maximintegrated.com>

[-- Attachment #1: Type: text/plain, Size: 746 bytes --]

On Wed, Jun 03, 2020 at 08:18:19PM +0900, Steve Lee wrote:

> +	param_start_addr = (dsm_param[0] & 0xff) | (dsm_param[1] & 0xff) << 8;
> +	param_size = (dsm_param[2] & 0xff) | (dsm_param[3] & 0xff) << 8;
> +	if (param_size > MAX98390_DSM_PARAM_MAX_SIZE ||
> +		param_start_addr < DSM_STBASS_HPF_B0_BYTE0) {
> +		dev_err(component->dev,
> +			"param fw is invalid.\n");
> +		goto err_alloc;
> +	}

This is now reading the size out of the header of the file which is good
but it should also validate that the file is big enough to have this
much data in it, otherwise it's possible to read beyond the end of the
firmware file (eg, if it got truncated somehow).  Previously the code
used the size of the file read from disk so that wasn't an issue.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

  parent reply	other threads:[~2020-06-03 11:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 11:18 [PATCH] ASoC: max98390: Fix potential crash during param fw loading Steve Lee
2020-06-03 11:24 ` Takashi Iwai
2020-06-03 11:30   ` Steve Lee
2020-06-03 11:31 ` Mark Brown [this message]
2020-06-03 11:37   ` Steve Lee
2020-06-03 11:42     ` Mark Brown
2020-06-03 23:48       ` Steve Lee

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=20200603113145.GC5327@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=dmurphy@ti.com \
    --cc=geert@linux-m68k.org \
    --cc=jack.yu@realtek.com \
    --cc=krzk@kernel.org \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=perex@perex.cz \
    --cc=rf@opensource.wolfsonmicro.com \
    --cc=ryan.lee.maxim@gmail.com \
    --cc=ryans.lee@maximintegrated.com \
    --cc=shumingf@realtek.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=steves.lee.maxim@gmail.com \
    --cc=steves.lee@maximintegrated.com \
    --cc=tiwai@suse.com \
    /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).