From: Vinod Koul <vinod.koul@intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: liam.r.girdwood@linux.intel.com, patches.audio@intel.com,
alsa-devel@alsa-project.org, Shreyas NC <shreyas.nc@intel.com>
Subject: Re: [PATCH v4] ASoC: Intel: Skylake: Add DSP firmware manifest parsing
Date: Mon, 16 May 2016 15:46:27 +0530 [thread overview]
Message-ID: <20160516101626.GO23734@localhost> (raw)
In-Reply-To: <20160513121417.GL22038@sirena.org.uk>
[-- Attachment #1.1: Type: text/plain, Size: 1393 bytes --]
On Fri, May 13, 2016 at 01:14:17PM +0100, Mark Brown wrote:
> On Fri, May 13, 2016 at 05:25:47PM +0530, Vinod Koul wrote:
>
> > + /* Get the FW pointer to derive ADSP header */
> > + buf = ctx->fw->data;
>
> > + adsp_hdr = (struct adsp_fw_hdr *)(buf + SKL_ADSP_FW_BIN_HDR_OFFSET);
>
> > + mod_entry = (struct adsp_module_entry *)
> > + (buf + SKL_ADSP_FW_BIN_HDR_OFFSET + adsp_hdr->header_len);
>
> What if we somehow managed to end up with a zero length firmware (or
> something smaller than these headers)?
I recall that firmware core checks if file is zero sized. But then it won't
help us here if the size is less than SKL_ADSP_FW_BIN_HDR_OFFSET, so will
add proper checks in this case as well
>
> > + /*
> > + * we check if current pointer is larger than file size from
> > + * base value to check excceding the file while parsing
> > + */
> > + if ((const char *)mod_entry >= buf + ctx->fw->size) {
> > + dev_err(ctx->dev,
> > + "Exceeds file bound: Entry %d Ptr %p\n",
> > + i, mod_entry);
> > +
> > + return -EIO;
> > + }
>
> This checks the start of the entry but it still lets us read beyond the
> end of the file.
Yup we need to check before incrementing, will fix that
Btw wanted to ask you on the update for this. Do you prefer that is sent
after merge window or anytime is fine by you :)
Thanks
--
~Vinod
[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
[-- Attachment #2: Type: text/plain, Size: 0 bytes --]
next prev parent reply other threads:[~2016-05-16 10:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-13 11:55 [PATCH v4] ASoC: Intel: Skylake: Add DSP firmware manifest parsing Vinod Koul
2016-05-13 12:14 ` Mark Brown
2016-05-16 10:16 ` Vinod Koul [this message]
2016-05-16 10:33 ` Mark Brown
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=20160516101626.GO23734@localhost \
--to=vinod.koul@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=patches.audio@intel.com \
--cc=shreyas.nc@intel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.