linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] ASoC: soc-pcm: crash in snd_soc_dapm_new_dai
@ 2020-01-19 14:19 Sameer Pujar
  2020-01-21 17:28 ` Applied "ASoC: soc-pcm: crash in snd_soc_dapm_new_dai" to the asoc tree Mark Brown
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Sameer Pujar @ 2020-01-19 14:19 UTC (permalink / raw)
  To: tiwai, perex; +Cc: broonie, alsa-devel, linux-kernel, Sameer Pujar

Crash happens in snd_soc_dapm_new_dai() when substream->private_data
access is made and substream is NULL here. This is seen for DAIs where
only playback or capture stream is defined. This seems to be happening
for codec2codec DAI link.

Both playback and capture are 0 during soc_new_pcm(). This is probably
happening because cpu_dai and codec_dai are both validated either for
SNDRV_PCM_STREAM_PLAYBACK or SNDRV_PCM_STREAM_CAPTURE.

Shouldn't be playback = 1 when,
 - playback stream is available for codec_dai AND
 - capture stream is available for cpu_dai

and vice-versa for capture = 1?

Signed-off-by: Sameer Pujar <spujar@nvidia.com>
---
 sound/soc/soc-pcm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index 74d340d..5aa9c0b 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2855,10 +2855,10 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 
 		for_each_rtd_codec_dai(rtd, i, codec_dai) {
 			if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) &&
-			    snd_soc_dai_stream_valid(cpu_dai,   SNDRV_PCM_STREAM_PLAYBACK))
+			    snd_soc_dai_stream_valid(cpu_dai,   SNDRV_PCM_STREAM_CAPTURE))
 				playback = 1;
 			if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) &&
-			    snd_soc_dai_stream_valid(cpu_dai,   SNDRV_PCM_STREAM_CAPTURE))
+			    snd_soc_dai_stream_valid(cpu_dai,   SNDRV_PCM_STREAM_PLAYBACK))
 				capture = 1;
 		}
 
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2020-02-17 17:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-19 14:19 [RFC] ASoC: soc-pcm: crash in snd_soc_dapm_new_dai Sameer Pujar
2020-01-21 17:28 ` Applied "ASoC: soc-pcm: crash in snd_soc_dapm_new_dai" to the asoc tree Mark Brown
2020-01-23  9:55 ` [RFC] ASoC: soc-pcm: crash in snd_soc_dapm_new_dai Sameer Pujar
2020-02-17 14:41 ` [alsa-devel] " Stephan Gerhold
2020-02-17 15:43   ` Mark Brown
2020-02-17 17:12     ` Stephan Gerhold
2020-02-17 17:19       ` Stephan Gerhold
2020-02-17 17:30       ` Mark Brown

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).