From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org
Cc: lgirdwood@gmail.com, Cezary Rojewski <cezary.rojewski@intel.com>,
broonie@kernel.org, tiwai@suse.com,
pierre-louis.bossart@linux.intel.com
Subject: [PATCH] ASoC: SOF: Intel: Fix stream cleanup on pcm close
Date: Tue, 18 Feb 2020 15:10:13 +0100 [thread overview]
Message-ID: <20200218141013.7290-1-cezary.rojewski@intel.com> (raw)
Field "substream" gets assigned during stream setup in
hda_dsp_pcm_hw_params() but it is never cleared afterwards during
hda_dsp_pcm_close(). Now, any non-pcm operation e.g.: compress can
mistakenly make use of that pointer as it's bypassing all
"if (s->substream)" checks.
Nulling the pointer during close operation ensures no wild pointers are
left behind.
Fixes: cdae3b9a47aa ("ASoC: SOF: Intel: Add Intel specific HDA PCM operations")
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
sound/soc/sof/intel/hda-pcm.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/sound/soc/sof/intel/hda-pcm.c b/sound/soc/sof/intel/hda-pcm.c
index a46a6baa1c3f..4b3a89cf20e7 100644
--- a/sound/soc/sof/intel/hda-pcm.c
+++ b/sound/soc/sof/intel/hda-pcm.c
@@ -246,5 +246,6 @@ int hda_dsp_pcm_close(struct snd_sof_dev *sdev,
/* unbinding pcm substream to hda stream */
substream->runtime->private_data = NULL;
+ hstream->substream = NULL;
return 0;
}
--
2.17.1
next reply other threads:[~2020-02-18 14:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-18 14:10 Cezary Rojewski [this message]
2020-02-18 16:45 ` [PATCH] ASoC: SOF: Intel: Fix stream cleanup on pcm close Pierre-Louis Bossart
2020-02-18 18:42 ` Cezary Rojewski
2020-02-18 19:05 ` Pierre-Louis Bossart
2020-03-12 11:54 ` Cezary Rojewski
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=20200218141013.7290-1-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=pierre-louis.bossart@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox