All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Sakamoto <takashi.sakamoto@miraclelinux.com>
To: broonie@kernel.org, jeeja.kp@intel.com, shreyas.nc@intel.com
Cc: alsa-devel@alsa-project.org, ichiro.suzuki@miraclelinux.com,
	yukie.kato@miraclelinux.com, hirotaka.furukawa@miraclelinux.com,
	ryotaro.shibata@miraclelinux.com,
	Takashi Sakamoto <o-takashi@sakamocchi.jp>,
	"# v4 . 5+" <stable@vger.kernel.org>
Subject: [PATCH] ASoC: Intel: Skylake: fix invalid memory access due to wrong reference of pointer
Date: Fri, 24 Feb 2017 11:48:41 +0900	[thread overview]
Message-ID: <20170224024841.10515-1-takashi.sakamoto@miraclelinux.com> (raw)

In 'skl_tplg_set_module_init_data()', a pointer to 'params' member of
'struct skl_algo_data' is calculated, then casted to (u32 *) and assigned
to a member of configuration data. The configuration data is passed to the
other functions and used to process intel IPC. In this processing, the
value of member is used to get message data, however this can bring invalid
memory access in 'skl_set_module_params()' as a result of calculation of
a pointer for actual message data.

(sound/soc/intel/skylake/skl-topology.c)
skl_tplg_init_pipe_modules()
->skl_tplg_set_module_init_data() (has this bug)
->skl_tplg_set_module_params()
  (sound/soc/intel/skylake/skl-messages.c)
  ->skl_set_module_params()
    ((char *)param) + data_offset

This commit fixes the bug.

Cc: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # v4.5+
Fixes: abb740033b56 ("ASoC: Intel: Skylake: Add support to configure module params")
Signed-off-by: Takashi Sakamoto <takashi.sakamoto@miraclelinux.com>
---
 sound/soc/intel/skylake/skl-topology.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index ed58b5b..2dbfb1b 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -512,7 +512,7 @@ static int skl_tplg_set_module_init_data(struct snd_soc_dapm_widget *w)
 			if (bc->set_params != SKL_PARAM_INIT)
 				continue;
 
-			mconfig->formats_config.caps = (u32 *)&bc->params;
+			mconfig->formats_config.caps = (u32 *)bc->params;
 			mconfig->formats_config.caps_size = bc->size;
 
 			break;
-- 
2.9.3

             reply	other threads:[~2017-02-24  2:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-02-24  2:48 Takashi Sakamoto [this message]
2017-03-02  8:56 ` [alsa-devel] [PATCH] ASoC: Intel: Skylake: fix invalid memory access due to wrong reference of pointer Vinod Koul
2017-03-02  8:56   ` Vinod Koul
2017-03-07 14:21 ` Applied "ASoC: Intel: Skylake: fix invalid memory access due to wrong reference of pointer" 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=20170224024841.10515-1-takashi.sakamoto@miraclelinux.com \
    --to=takashi.sakamoto@miraclelinux.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=hirotaka.furukawa@miraclelinux.com \
    --cc=ichiro.suzuki@miraclelinux.com \
    --cc=jeeja.kp@intel.com \
    --cc=o-takashi@sakamocchi.jp \
    --cc=ryotaro.shibata@miraclelinux.com \
    --cc=shreyas.nc@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=yukie.kato@miraclelinux.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.