[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <DM5PR11MB20410DF19D2353D0C0C04CFC92880@DM5PR11MB2041.namprd11.prod.outlook.com>
Date: Wed, 3 Jun 2020 23:48:43 +0000
From: Steve Lee <SteveS.Lee@...imintegrated.com>
To: Mark Brown <broonie@...nel.org>
CC: "lgirdwood@...il.com" <lgirdwood@...il.com>,
"perex@...ex.cz" <perex@...ex.cz>,
"tiwai@...e.com" <tiwai@...e.com>,
"ckeepax@...nsource.cirrus.com" <ckeepax@...nsource.cirrus.com>,
"geert@...ux-m68k.org" <geert@...ux-m68k.org>,
"rf@...nsource.wolfsonmicro.com" <rf@...nsource.wolfsonmicro.com>,
"shumingf@...ltek.com" <shumingf@...ltek.com>,
"srinivas.kandagatla@...aro.org" <srinivas.kandagatla@...aro.org>,
"krzk@...nel.org" <krzk@...nel.org>,
"dmurphy@...com" <dmurphy@...com>,
"jack.yu@...ltek.com" <jack.yu@...ltek.com>,
"nuno.sa@...log.com" <nuno.sa@...log.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>,
"ryan.lee.maxim@...il.com" <ryan.lee.maxim@...il.com>,
Ryan Lee <RyanS.Lee@...imintegrated.com>,
"steves.lee.maxim@...il.com" <steves.lee.maxim@...il.com>
Subject: RE: [PATCH] ASoC: max98390: Fix potential crash during param fw
loading
> -----Original Message-----
> From: Mark Brown <broonie@...nel.org>
> Sent: Wednesday, June 3, 2020 8:43 PM
> To: Steve Lee <SteveS.Lee@...imintegrated.com>
> Cc: lgirdwood@...il.com; perex@...ex.cz; tiwai@...e.com;
> ckeepax@...nsource.cirrus.com; geert@...ux-m68k.org;
> rf@...nsource.wolfsonmicro.com; shumingf@...ltek.com;
> srinivas.kandagatla@...aro.org; krzk@...nel.org; dmurphy@...com;
> jack.yu@...ltek.com; nuno.sa@...log.com; linux-kernel@...r.kernel.org;
> alsa-devel@...a-project.org; ryan.lee.maxim@...il.com; Ryan Lee
> <RyanS.Lee@...imintegrated.com>; steves.lee.maxim@...il.com
> Subject: Re: [PATCH] ASoC: max98390: Fix potential crash during param fw
> loading
>
> 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.
Yes, I will update this and good enough.
Powered by blists - more mailing lists