mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Steve Lee <SteveS.Lee@maximintegrated.com>
Cc: "lgirdwood@gmail.com" <lgirdwood@gmail.com>,
	"perex@perex.cz" <perex@perex.cz>,
	"tiwai@suse.com" <tiwai@suse.com>,
	"ckeepax@opensource.cirrus.com" <ckeepax@opensource.cirrus.com>,
	"geert@linux-m68k.org" <geert@linux-m68k.org>,
	"rf@opensource.wolfsonmicro.com" <rf@opensource.wolfsonmicro.com>,
	"shumingf@realtek.com" <shumingf@realtek.com>,
	"srinivas.kandagatla@linaro.org" <srinivas.kandagatla@linaro.org>,
	"krzk@kernel.org" <krzk@kernel.org>,
	"dmurphy@ti.com" <dmurphy@ti.com>,
	"jack.yu@realtek.com" <jack.yu@realtek.com>,
	"nuno.sa@analog.com" <nuno.sa@analog.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"alsa-devel@alsa-project.org" <alsa-devel@alsa-project.org>,
	"ryan.lee.maxim@gmail.com" <ryan.lee.maxim@gmail.com>,
	Ryan Lee <RyanS.Lee@maximintegrated.com>,
	"steves.lee.maxim@gmail.com" <steves.lee.maxim@gmail.com>
Subject: Re: [PATCH] ASoC: max98390: Fix potential crash during param fw loading
Date: Wed, 3 Jun 2020 12:42:41 +0100	[thread overview]
Message-ID: <20200603114241.GD5327@sirena.org.uk> (raw)
In-Reply-To: <MWHPR11MB2047B58F4B5E395CB76CCB2392880@MWHPR11MB2047.namprd11.prod.outlook.com>

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

On Wed, Jun 03, 2020 at 11:37:44AM +0000, Steve Lee wrote:

> > 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.

>  Thanks for quick comment. Can this case cover by below line?
> +	if (fw->size < MAX98390_DSM_PARAM_MIN_SIZE) {
> +		dev_err(component->dev,
> +			"param fw is invalid.\n");
> +		goto err_alloc;
> +	}

No, that doesn't cover all of it - the case I'm concerned about is the
case where we've got enough data for the header but the payload is
truncated.  You need a check that param_size + _PAYLOAD_OFFSET is less
than fw->size as well.

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

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

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 11:18 Steve Lee
2020-06-03 11:24 ` Takashi Iwai
2020-06-03 11:30   ` Steve Lee
2020-06-03 11:31 ` Mark Brown
2020-06-03 11:37   ` Steve Lee
2020-06-03 11:42     ` Mark Brown [this message]
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=20200603114241.GD5327@sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=RyanS.Lee@maximintegrated.com \
    --cc=SteveS.Lee@maximintegrated.com \
    --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=shumingf@realtek.com \
    --cc=srinivas.kandagatla@linaro.org \
    --cc=steves.lee.maxim@gmail.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

all inboxes | Powered by JetHome®