]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/5.0.14/asoc-wm_adsp-check-for-buffer-in-trigger-stop.patch
Linux 5.0.14
[thirdparty/kernel/stable-queue.git] / releases / 5.0.14 / asoc-wm_adsp-check-for-buffer-in-trigger-stop.patch
1 From 43d147be5738a9ed6cfb25c285ac50d6dd5793be Mon Sep 17 00:00:00 2001
2 From: Charles Keepax <ckeepax@opensource.cirrus.com>
3 Date: Tue, 2 Apr 2019 13:49:14 +0100
4 Subject: ASoC: wm_adsp: Check for buffer in trigger stop
5
6 From: Charles Keepax <ckeepax@opensource.cirrus.com>
7
8 commit 43d147be5738a9ed6cfb25c285ac50d6dd5793be upstream.
9
10 Trigger stop can be called in situations where trigger start failed
11 and as such it can't be assumed the buffer is already attached to
12 the compressed stream or a NULL pointer may be dereferenced.
13
14 Fixes: 639e5eb3c7d6 ("ASoC: wm_adsp: Correct handling of compressed streams that restart")
15 Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
16 Signed-off-by: Mark Brown <broonie@kernel.org>
17 Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
18 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
19
20 ---
21 sound/soc/codecs/wm_adsp.c | 3 ++-
22 1 file changed, 2 insertions(+), 1 deletion(-)
23
24 --- a/sound/soc/codecs/wm_adsp.c
25 +++ b/sound/soc/codecs/wm_adsp.c
26 @@ -3454,7 +3454,8 @@ int wm_adsp_compr_trigger(struct snd_com
27 }
28 break;
29 case SNDRV_PCM_TRIGGER_STOP:
30 - wm_adsp_buffer_clear(compr->buf);
31 + if (wm_adsp_compr_attached(compr))
32 + wm_adsp_buffer_clear(compr->buf);
33 break;
34 default:
35 ret = -EINVAL;