ASoC: soc-compress.c: fix NULL dereference
authorQais Yousef <qais.yousef@imgtec.com>
Wed, 14 Jan 2015 08:47:29 +0000 (08:47 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 6 Feb 2015 06:35:48 +0000 (22:35 -0800)
commitf48df470bc8d9f106d1833f36a3f8944d3588346
treedcac5b7ee21a198295b7910ce0ad870c528a3aaf
parentf1251f53c8da53443b33eefce82772176be9452a
ASoC: soc-compress.c: fix NULL dereference

commit d3268a40d4b19ff7bee23f52eabbc4e96bb685e8 upstream.

In soc_new_compress() when rtd->dai_link->dynamic is set, we create the pcm
substreams with this call:

   ret = snd_pcm_new_internal(rtd->card->snd_card, new_name, num,
                                   1, 0, &be_pcm);

which passes 0 as capture_count leading to

   be_pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream

being NULL, hence when trying to set rtd a few lines below we get an oops.

Fix by using rtd->dai_link->dpcm_playback and rtd->dai_link->dpcm_capture as
playback_count and capture_count to snd_pcm_new_internal().

Signed-off-by: Qais Yousef <qais.yousef@imgtec.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
sound/soc/soc-compress.c