All of lore.kernel.org
 help / color / mirror / Atom feed
From: Kai Vehmanen <kai.vehmanen@linux.intel.com>
To: Cezary Rojewski <cezary.rojewski@intel.com>,
	 Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: alsa-devel@alsa-project.org, broonie@kernel.org,
	Ranjani Sridharan <ranjani.sridharan@linux.intel.com>,
	lgirdwood@gmail.com, tiwai@suse.com
Subject: Re: [alsa-devel] [PATCH] ASoC: Intel: skl_hda_dsp_common: Fix global-out-of-bounds bug
Date: Thu, 23 Jan 2020 10:31:23 +0200 (EET)	[thread overview]
Message-ID: <alpine.DEB.2.21.2001230951530.2957@eliteleevi.tm.intel.com> (raw)
In-Reply-To: <0c4a19c3-f1e3-7b76-be42-e4902645955b@linux.intel.com>

Hi,

On Wed, 22 Jan 2020, Pierre-Louis Bossart wrote:

> On 1/22/20 12:12 PM, Cezary Rojewski wrote:
> > Definitions for idisp snd_soc_dai_links within skl_hda_dsp_common are
> > missing platform component. Add it to address following bug reported by
> > KASAN:
[...]
> > [   10.538502] BUG: KASAN: global-out-of-bounds in
> > skl_hda_audio_probe+0x13a/0x2b0 [snd_soc_skl_hda_dsp]
> > [   10.538509] Write of size 8 at addr ffffffffc0606840 by task
> > systemd-udevd/299
> > (...)
> 
> You could probably skip the call trace, it doesn't really provide much
> information.
> 
> Kai and Ranjani, do you think this impacts SOF as well? Or does our BE
> override somehow suppresses the problem?

yes, this is a good catch Cezary! We actually initialize the platform 
correctly in other machine drivers, so this is a specific bug in the 
generic HDA mach driver.

What happens is that 'platforms' is initialized to an empty array:

static struct snd_soc_dai_link_component idisp1_cpus[] = { { .dai_name = "iDisp1 Pin", } }; 
static struct snd_soc_dai_link_component idisp1_codecs[] = { { .name = "ehdaudio0D2", .dai_name = "intel-hdmi-hifi1", } };
static struct snd_soc_dai_link_component idisp1_platforms[] = { }

... but then before card registration, mach driver code assumes there is 
at least one platform in the array:

»       for_each_card_prelinks(card, i, dai_link)                      
»       »       dai_link->platforms->name = mach_params->platform; 

... and this results in out-of-bound write.

Cezary's patch is aligned with other machine drivers and typical ASOC
macro usage so:

Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>

I'll check if other machine drivers are impacted as well.

Br, Kai
_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
https://mailman.alsa-project.org/mailman/listinfo/alsa-devel

  parent reply	other threads:[~2020-01-23  8:32 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-22 18:12 [alsa-devel] [PATCH] ASoC: Intel: skl_hda_dsp_common: Fix global-out-of-bounds bug Cezary Rojewski
2020-01-22 18:27 ` Cezary Rojewski
2020-01-22 19:52   ` Pierre-Louis Bossart
2020-01-23 15:10     ` Wasko, Michal
2020-01-23 18:22       ` Pierre-Louis Bossart
2020-01-27 13:05         ` Wasko, Michal
2020-01-27 15:30           ` Pierre-Louis Bossart
2020-01-28 19:40             ` Wasko, Michal
2020-01-22 19:55 ` Pierre-Louis Bossart
2020-01-22 21:30   ` Sridharan, Ranjani
2020-01-22 21:32     ` Mark Brown
2020-01-22 21:54     ` Pierre-Louis Bossart
2020-01-22 23:04       ` Sridharan, Ranjani
2020-01-23  8:31   ` Kai Vehmanen [this message]
2020-01-23 12:36 ` [alsa-devel] Applied "ASoC: Intel: skl_hda_dsp_common: Fix global-out-of-bounds bug" to the asoc tree 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=alpine.DEB.2.21.2001230951530.2957@eliteleevi.tm.intel.com \
    --to=kai.vehmanen@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=lgirdwood@gmail.com \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=ranjani.sridharan@linux.intel.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 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.