From: Dan Carpenter <dan.carpenter@oracle.com>
To: Liam Girdwood <lgirdwood@gmail.com>, Jeeja KP <jeeja.kp@intel.com>
Cc: alsa-devel@alsa-project.org,
Dharageswari R <dharageswari.r@intel.com>,
Vinod Koul <vinod.koul@intel.com>,
Pardha Saradhi K <pardha.saradhi.kesapragada@intel.com>,
kernel-janitors@vger.kernel.org, Takashi Iwai <tiwai@suse.com>,
G Kranthi <gudishax.kranthikumar@intel.com>,
Mark Brown <broonie@kernel.org>,
Hardik T Shah <hardik.t.shah@intel.com>,
"Subhransu S. Prusty" <subhransu.s.prusty@intel.com>
Subject: [PATCH] ASoC: Intel: Skylake: Fix a couple user after free bugs
Date: Fri, 14 Apr 2017 19:11:20 +0000 [thread overview]
Message-ID: <20170414191120.GA30875@mwanda> (raw)
We need to use the _safe() version of list_for_each_entry() here because
of the kfree(modules).
Fixes: b8c722ddd548 ("ASoC: Intel: Skylake: Add support for deferred DSP module bind")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c
index 600faad19bd4..d43d1976dd3b 100644
--- a/sound/soc/intel/skylake/skl-pcm.c
+++ b/sound/soc/intel/skylake/skl-pcm.c
@@ -1323,10 +1323,10 @@ int skl_platform_unregister(struct device *dev)
{
struct hdac_ext_bus *ebus = dev_get_drvdata(dev);
struct skl *skl = ebus_to_skl(ebus);
- struct skl_module_deferred_bind *modules;
+ struct skl_module_deferred_bind *modules, *tmp;
if (!list_empty(&skl->bind_list)) {
- list_for_each_entry(modules, &skl->bind_list, node) {
+ list_for_each_entry_safe(modules, tmp, &skl->bind_list, node) {
list_del(&modules->node);
kfree(modules);
}
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c
index 74b3acf3bb07..aea7917e791c 100644
--- a/sound/soc/intel/skylake/skl-topology.c
+++ b/sound/soc/intel/skylake/skl-topology.c
@@ -1091,7 +1091,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
struct skl_module_cfg *src_module = NULL, *dst_module;
struct skl_sst *ctx = skl->skl_sst;
struct skl_pipe *s_pipe = mconfig->pipe;
- struct skl_module_deferred_bind *modules;
+ struct skl_module_deferred_bind *modules, *tmp;
if (s_pipe->state = SKL_PIPE_INVALID)
return -EINVAL;
@@ -1105,7 +1105,7 @@ static int skl_tplg_mixer_dapm_post_pmd_event(struct snd_soc_dapm_widget *w,
src_module = w_module->w->priv;
- list_for_each_entry(modules, &skl->bind_list, node) {
+ list_for_each_entry_safe(modules, tmp, &skl->bind_list, node) {
/*
* When the destination module is deleted, Unbind the
* modules from deferred bind list.
next reply other threads:[~2017-04-14 19:11 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-14 19:11 Dan Carpenter [this message]
2017-04-21 17:28 ` Applied "ASoC: Intel: Skylake: Fix a couple user after free bugs" 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=20170414191120.GA30875@mwanda \
--to=dan.carpenter@oracle.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=dharageswari.r@intel.com \
--cc=gudishax.kranthikumar@intel.com \
--cc=hardik.t.shah@intel.com \
--cc=jeeja.kp@intel.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=lgirdwood@gmail.com \
--cc=pardha.saradhi.kesapragada@intel.com \
--cc=subhransu.s.prusty@intel.com \
--cc=tiwai@suse.com \
--cc=vinod.koul@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).