]> git.proxmox.com Git - mirror_ubuntu-disco-kernel.git/commitdiff
ASoC: wm_adsp: Check for buffer in trigger stop
authorCharles Keepax <ckeepax@opensource.cirrus.com>
Tue, 2 Apr 2019 12:49:14 +0000 (13:49 +0100)
committerStefan Bader <stefan.bader@canonical.com>
Tue, 2 Jul 2019 10:07:53 +0000 (12:07 +0200)
BugLink: https://bugs.launchpad.net/bugs/1832775
commit 43d147be5738a9ed6cfb25c285ac50d6dd5793be upstream.

Trigger stop can be called in situations where trigger start failed
and as such it can't be assumed the buffer is already attached to
the compressed stream or a NULL pointer may be dereferenced.

Fixes: 639e5eb3c7d6 ("ASoC: wm_adsp: Correct handling of compressed streams that restart")
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Cc: Nobuhiro Iwamatsu <nobuhiro1.iwamatsu@toshiba.co.jp>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Connor Kuehl <connor.kuehl@canonical.com>
Signed-off-by: Kleber Sacilotto de Souza <kleber.souza@canonical.com>
sound/soc/codecs/wm_adsp.c

index 8219e8f0630ee84eb474c3abbe29a57e467da6ca..0600e4404f908b68391dec682858c08f3faa4d05 100644 (file)
@@ -3454,7 +3454,8 @@ int wm_adsp_compr_trigger(struct snd_compr_stream *stream, int cmd)
                }
                break;
        case SNDRV_PCM_TRIGGER_STOP:
-               wm_adsp_buffer_clear(compr->buf);
+               if (wm_adsp_compr_attached(compr))
+                       wm_adsp_buffer_clear(compr->buf);
                break;
        default:
                ret = -EINVAL;