mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] sound: atom: fix a missing check  of snd_pcm_lib_malloc_pages
@ 2018-12-26  2:29 Kangjie Lu
  2018-12-26 17:57 ` Pierre-Louis Bossart
  2019-01-07 18:10 ` Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Kangjie Lu @ 2018-12-26  2:29 UTC (permalink / raw)
  To: kjlu
  Cc: pakki001, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Mark Brown, Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto,
	alsa-devel, linux-kernel

snd_pcm_lib_malloc_pages() may fail, so let's check its status and
return its error code upstream.

Signed-off-by: Kangjie Lu <kjlu@umn.edu>
---
 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;
 }
-- 
2.17.2 (Apple Git-113)


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

* Re: [PATCH] sound: atom: fix a missing check of snd_pcm_lib_malloc_pages
  2018-12-26  2:29 [PATCH] sound: atom: fix a missing check of snd_pcm_lib_malloc_pages Kangjie Lu
@ 2018-12-26 17:57 ` Pierre-Louis Bossart
  2019-01-01  8:34   ` Takashi Iwai
  2019-01-07 18:10 ` Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Pierre-Louis Bossart @ 2018-12-26 17:57 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Liam Girdwood, Jie Yang, Mark Brown, Jaroslav Kysela,
	Takashi Iwai, Kuninori Morimoto, alsa-devel, linux-kernel


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 <pierre-louis.bossart@linux.intel.com>


>
> Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> ---
>   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;
>   }

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

* Re: [PATCH] sound: atom: fix a missing check of snd_pcm_lib_malloc_pages
  2018-12-26 17:57 ` Pierre-Louis Bossart
@ 2019-01-01  8:34   ` Takashi Iwai
  0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2019-01-01  8:34 UTC (permalink / raw)
  To: Pierre-Louis Bossart
  Cc: Kangjie Lu, alsa-devel, Mark Brown, Liam Girdwood, Jie Yang,
	Jaroslav Kysela, Kuninori Morimoto, pakki001, linux-kernel

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 <pierre-louis.bossart@linux.intel.com>

This fixes a potential kernel Oops.  Mark, please put Cc to stable
when applying.


thanks,

Takashi

> 
> 
> >
> > Signed-off-by: Kangjie Lu <kjlu@umn.edu>
> > ---
> >   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;
> >   }
> 

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

* Re: [PATCH] sound: atom: fix a missing check  of snd_pcm_lib_malloc_pages
  2018-12-26  2:29 [PATCH] sound: atom: fix a missing check of snd_pcm_lib_malloc_pages Kangjie Lu
  2018-12-26 17:57 ` Pierre-Louis Bossart
@ 2019-01-07 18:10 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2019-01-07 18:10 UTC (permalink / raw)
  To: Kangjie Lu
  Cc: pakki001, Pierre-Louis Bossart, Liam Girdwood, Jie Yang,
	Jaroslav Kysela, Takashi Iwai, Kuninori Morimoto, alsa-devel,
	linux-kernel

[-- Attachment #1: Type: text/plain, Size: 291 bytes --]

On Tue, Dec 25, 2018 at 08:29:48PM -0600, Kangjie Lu wrote:
> snd_pcm_lib_malloc_pages() may fail, so let's check its status and
> return its error code upstream.


Please use subject lines matching the style for the subsystem.  This
makes it easier for people to identify relevant patches.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2019-01-07 18:10 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-26  2:29 [PATCH] sound: atom: fix a missing check of snd_pcm_lib_malloc_pages Kangjie Lu
2018-12-26 17:57 ` Pierre-Louis Bossart
2019-01-01  8:34   ` Takashi Iwai
2019-01-07 18:10 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®