]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blame - queue-4.4/asoc-intel-avoid-oops-if-dma-setup-fails.patch
4.4-stable patches
[thirdparty/kernel/stable-queue.git] / queue-4.4 / asoc-intel-avoid-oops-if-dma-setup-fails.patch
CommitLineData
544566e1
GKH
1From 0efa3334d65b7f421ba12382dfa58f6ff5bf83c4 Mon Sep 17 00:00:00 2001
2From: Ross Zwisler <zwisler@chromium.org>
3Date: Mon, 29 Apr 2019 12:25:17 -0600
4Subject: ASoC: Intel: avoid Oops if DMA setup fails
5
6From: Ross Zwisler <zwisler@chromium.org>
7
8commit 0efa3334d65b7f421ba12382dfa58f6ff5bf83c4 upstream.
9
10Currently in sst_dsp_new() if we get an error return from sst_dma_new()
11we just print an error message and then still complete the function
12successfully. This means that we are trying to run without sst->dma
13properly set up, which will result in NULL pointer dereference when
14sst->dma is later used. This was happening for me in
15sst_dsp_dma_get_channel():
16
17 struct sst_dma *dma = dsp->dma;
18 ...
19 dma->ch = dma_request_channel(mask, dma_chan_filter, dsp);
20
21This resulted in:
22
23 BUG: unable to handle kernel NULL pointer dereference at 0000000000000018
24 IP: sst_dsp_dma_get_channel+0x4f/0x125 [snd_soc_sst_firmware]
25
26Fix this by adding proper error handling for the case where we fail to
27set up DMA.
28
29This change only affects Haswell and Broadwell systems. Baytrail
30systems explicilty opt-out of DMA via sst->pdata->resindex_dma_base
31being set to -1.
32
33Signed-off-by: Ross Zwisler <zwisler@google.com>
34Cc: stable@vger.kernel.org
35Acked-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
36Signed-off-by: Mark Brown <broonie@kernel.org>
37Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
38
39---
40 sound/soc/intel/common/sst-dsp.c | 8 ++++++--
41 1 file changed, 6 insertions(+), 2 deletions(-)
42
43--- a/sound/soc/intel/common/sst-dsp.c
44+++ b/sound/soc/intel/common/sst-dsp.c
45@@ -463,11 +463,15 @@ struct sst_dsp *sst_dsp_new(struct devic
46 goto irq_err;
47
48 err = sst_dma_new(sst);
49- if (err)
50- dev_warn(dev, "sst_dma_new failed %d\n", err);
51+ if (err) {
52+ dev_err(dev, "sst_dma_new failed %d\n", err);
53+ goto dma_err;
54+ }
55
56 return sst;
57
58+dma_err:
59+ free_irq(sst->irq, sst);
60 irq_err:
61 if (sst->ops->free)
62 sst->ops->free(sst);