From: Takashi Iwai Subject: Re: [PATCH] sound: atom: fix a missing check of snd_pcm_lib_malloc_pages Date: Tue, 01 Jan 2019 09:34:14 +0100 Message-ID: References: <20181226022950.71824-1-kjlu@umn.edu> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) by alsa0.perex.cz (Postfix) with ESMTP id B4D03267A86 for ; Tue, 1 Jan 2019 09:34:15 +0100 (CET) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Pierre-Louis Bossart Cc: alsa-devel@alsa-project.org, Kuninori Morimoto , Kangjie Lu , Jie Yang , linux-kernel@vger.kernel.org, Liam Girdwood , Mark Brown , pakki001@umn.edu List-Id: alsa-devel@alsa-project.org On Wed, 26 Dec 2018 18:57:47 +0100, Pierre-Louis Bossart wrote: > > > On 12/25/18 8:29 PM, Kangjie Lu wrote: > > snd_pcm_lib_malloc_pages() may fail, so let's check its status and > > return its error code upstream. > > Acked-by: Pierre-Louis Bossart This fixes a potential kernel Oops. Mark, please put Cc to stable when applying. thanks, Takashi > > > > > > Signed-off-by: Kangjie Lu > > --- > > sound/soc/intel/atom/sst-mfld-platform-pcm.c | 8 +++++++- > > 1 file changed, 7 insertions(+), 1 deletion(-) > > > > diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c > > index afc559866095..91a2436ce952 100644 > > --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c > > +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c > > @@ -399,7 +399,13 @@ static int sst_media_hw_params(struct snd_pcm_substream *substream, > > struct snd_pcm_hw_params *params, > > struct snd_soc_dai *dai) > > { > > - snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(params)); > > + int ret; > > + > > + ret = > > + snd_pcm_lib_malloc_pages(substream, > > + params_buffer_bytes(params)); > > + if (ret) > > + return ret; > > memset(substream->runtime->dma_area, 0, params_buffer_bytes(params)); > > return 0; > > } >