From: Ross Zwisler <zwisler@chromium.org>
To: Sasha Levin <sashal@kernel.org>
Cc: Ross Zwisler <zwisler@chromium.org>,
linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Ross Zwisler <zwisler@google.com>,
Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>,
Mark Brown <broonie@kernel.org>
Subject: [linux-4.4.y PATCH] ASoC: Intel: avoid Oops if DMA setup fails
Date: Fri, 3 May 2019 13:45:03 -0600 [thread overview]
Message-ID: <20190503194503.77923-1-zwisler@google.com> (raw)
In-Reply-To: <20190429182710.GA209252@google.com>
From: Ross Zwisler <zwisler@chromium.org>
commit 0efa3334d65b7f421ba12382dfa58f6ff5bf83c4 upstream.
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.
This change only affects Haswell and Broadwell systems. Baytrail
systems explicilty opt-out of DMA via sst->pdata->resindex_dma_base
being set to -1.
Signed-off-by: Ross Zwisler <zwisler@google.com>
Cc: stable@vger.kernel.org
Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
---
The upstream patch applied cleanly to all stable trees except
linux-4.4.y and linux-3.18.y. This is the backport for linux-4.4.y, and
the code I'm fixing was introduced in v4.0 so there is no need for a
linux-3.18.y backport.
The upstream patch is currently in Mark Brown's tree:
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git/log/?h=for-next
Is that good enough, or should I resend after it's been merged in the
v5.2 merge window?
---
sound/soc/intel/common/sst-dsp.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/sound/soc/intel/common/sst-dsp.c b/sound/soc/intel/common/sst-dsp.c
index c9452e02e0dda..c0a50ecb6dbda 100644
--- a/sound/soc/intel/common/sst-dsp.c
+++ b/sound/soc/intel/common/sst-dsp.c
@@ -463,11 +463,15 @@ struct sst_dsp *sst_dsp_new(struct device *dev,
goto irq_err;
err = sst_dma_new(sst);
- if (err)
- dev_warn(dev, "sst_dma_new failed %d\n", err);
+ if (err) {
+ dev_err(dev, "sst_dma_new failed %d\n", err);
+ goto dma_err;
+ }
return sst;
+dma_err:
+ free_irq(sst->irq, sst);
irq_err:
if (sst->ops->free)
sst->ops->free(sst);
--
2.21.0.1020.gf2820cf01a-goog
next prev parent reply other threads:[~2019-05-03 19:45 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-26 16:47 [PATCH] " Ross Zwisler
2019-04-26 21:03 ` Pierre-Louis Bossart
2019-04-29 17:02 ` Ross Zwisler
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:21 ` 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 ` Ross Zwisler [this message]
2019-05-05 13:15 ` [linux-4.4.y PATCH] " 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=20190503194503.77923-1-zwisler@google.com \
--to=zwisler@chromium.org \
--cc=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=sashal@kernel.org \
--cc=stable@vger.kernel.org \
--cc=zwisler@google.com \
/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 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®