All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ross Zwisler <zwisler@google.com>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: Ross Zwisler <zwisler@chromium.org>,
	linux-kernel@vger.kernel.org, Jaroslav Kysela <perex@perex.cz>,
	Jie Yang <yang.jie@linux.intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Mark Brown <broonie@kernel.org>, Takashi Iwai <tiwai@suse.com>,
	alsa-devel@alsa-project.org, stable@vger.kernel.org
Subject: Re: [PATCH] ASoC: Intel: avoid Oops if DMA setup fails
Date: Mon, 29 Apr 2019 11:02:19 -0600	[thread overview]
Message-ID: <20190429170219.GA89435@google.com> (raw)
In-Reply-To: <0b030b85-00c8-2e35-3064-bb764aaff0f6@linux.intel.com>

On Fri, Apr 26, 2019 at 04:03:47PM -0500, Pierre-Louis Bossart wrote:
> On 4/26/19 11:47 AM, Ross Zwisler wrote:
> > Currently in sst_dsp_new() if we get an error return from sst_dma_new()
> > we just print an error message and then still complete the function
> > successfully.  This means that we are trying to run without sst->dma
> > properly set up, which will result in NULL pointer dereference when
> > sst->dma is later used.  This was happening for me in
> > sst_dsp_dma_get_channel():
> > 
> >          struct sst_dma *dma = dsp->dma;
> > 	...
> >          dma->ch = dma_request_channel(mask, dma_chan_filter, dsp);
> > 
> > This resulted in:
> > 
> >     BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
> >     IP: sst_dsp_dma_get_channel+0x4f/0x125 [snd_soc_sst_firmware]
> > 
> > Fix this by adding proper error handling for the case where we fail to
> > set up DMA.
> > 
> > Signed-off-by: Ross Zwisler <zwisler@google.com>
> > Cc: stable@vger.kernel.org
> > ---
> >   sound/soc/intel/common/sst-firmware.c | 6 +++++-
> >   1 file changed, 5 insertions(+), 1 deletion(-)
> > 
> > diff --git a/sound/soc/intel/common/sst-firmware.c b/sound/soc/intel/common/sst-firmware.c
> > index 1e067504b6043..9be3a793a55e3 100644
> > --- a/sound/soc/intel/common/sst-firmware.c
> > +++ b/sound/soc/intel/common/sst-firmware.c
> > @@ -1251,11 +1251,15 @@ struct sst_dsp *sst_dsp_new(struct device *dev,
> >   		goto irq_err;
> >   	err = sst_dma_new(sst);
> > -	if (err)
> > +	if (err)  {
> >   		dev_warn(dev, "sst_dma_new failed %d\n", err);
> > +		goto dma_err;
> > +	}
> 
> Thanks for the patch.
> The fix looks correct, but does it make sense to keep a dev_warn() here?
> Should it be changed to dev_err() instead since as you mentioned it's fatal
> to keep going.
> Also you may want to mention in the commit message that this should only
> impact Broadwell and maybe the legacy Baytrail driver. IIRC we don't use the
> DMAs in other cases.

Sure, I'll address both of these in a v2.  Thank you for the quick review.

  reply	other threads:[~2019-04-29 17:02 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-26 16:47 [PATCH] ASoC: Intel: avoid Oops if DMA setup fails Ross Zwisler
2019-04-26 21:03 ` Pierre-Louis Bossart
2019-04-29 17:02   ` Ross Zwisler [this message]
2019-04-29 18:25   ` [PATCH v2] " Ross Zwisler
2019-04-29 18:45     ` Pierre-Louis Bossart
2019-05-03  4:34     ` Mark Brown
2019-05-03  6:18     ` Applied "ASoC: Intel: avoid Oops if DMA setup fails" to the asoc tree Mark Brown
2019-05-03  6:18       ` Mark Brown
2019-05-03  6:21     ` Mark Brown
2019-05-03  6:21       ` Mark Brown
2019-05-03  6:23     ` Mark Brown
2019-05-03  6:23       ` Mark Brown
     [not found] ` <20190426185246.AD8E5206A3@mail.kernel.org>
2019-04-29 18:27   ` [PATCH] ASoC: Intel: avoid Oops if DMA setup fails Ross Zwisler
2019-05-03 19:45     ` [linux-4.4.y PATCH] " Ross Zwisler
2019-05-05 13:15       ` Greg KH
2019-05-09 17:41         ` Greg KH
2019-05-09 18:11           ` Ross Zwisler

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190429170219.GA89435@google.com \
    --to=zwisler@google.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=pierre-louis.bossart@linux.intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    --cc=yang.jie@linux.intel.com \
    --cc=zwisler@chromium.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.