Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754752AbaLWJKN (ORCPT ); Tue, 23 Dec 2014 04:10:13 -0500 Received: from mailapp01.imgtec.com ([195.59.15.196]:26114 "EHLO mailapp01.imgtec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752369AbaLWJKK (ORCPT ); Tue, 23 Dec 2014 04:10:10 -0500 From: Qais Yousef To: CC: Qais Yousef , Vinod Koul , Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai , Subject: [PATCH] ALSA: ASoC: soc-compress.c: fix NULL dereference Date: Tue, 23 Dec 2014 09:09:27 +0000 Message-ID: <1419325767-30602-1-git-send-email-qais.yousef@imgtec.com> X-Mailer: git-send-email 2.1.0 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [192.168.154.94] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In soc_new_compress() when rtd->dai_link->daynmic 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 removing this line of code since CAPTURE substream will always be NULL. Signed-off-by: Qais Yousef Cc: Vinod Koul Cc: Liam Girdwood Cc: Mark Brown Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: linux-kernel@vger.kernel.org --- Not sure if this is the correct fix but that's what I could come up with my limited knowledge. I think the more correct solution would be to use the value of rtd->dai_link->dpcm_playback and rtd->dai_link->dpcm_capture in the args of snd_pcm_new_internal() for playback_count and capture_count. sound/soc/soc-compress.c | 1 - 1 file changed, 1 deletion(-) diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 590a82f01d0b..7ab39f65384c 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -669,7 +669,6 @@ int soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) rtd->pcm = be_pcm; rtd->fe_compr = 1; be_pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream->private_data = rtd; - be_pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream->private_data = rtd; memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops)); } else memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/