]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - queue-4.19/alsa-pcm-check-if-ops-are-defined-before-suspending-.patch
Linux 4.14.111
[thirdparty/kernel/stable-queue.git] / queue-4.19 / alsa-pcm-check-if-ops-are-defined-before-suspending-.patch
1 From 069b63a147ed5ed28d6d7f88e25bd8a6d45977ca Mon Sep 17 00:00:00 2001
2 From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
3 Date: Fri, 8 Feb 2019 17:29:53 -0600
4 Subject: ALSA: PCM: check if ops are defined before suspending PCM
5
6 [ Upstream commit d9c0b2afe820fa3b3f8258a659daee2cc71ca3ef ]
7
8 BE dai links only have internal PCM's and their substream ops may
9 not be set. Suspending these PCM's will result in their
10 ops->trigger() being invoked and cause a kernel oops.
11 So skip suspending PCM's if their ops are NULL.
12
13 [ NOTE: this change is required now for following the recent PCM core
14 change to get rid of snd_pcm_suspend() call. Since DPCM BE takes
15 the runtime carried from FE while keeping NULL ops, it can hit this
16 bug. See details at:
17 https://github.com/thesofproject/linux/pull/582
18 -- tiwai ]
19
20 Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
21 Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
22 Signed-off-by: Takashi Iwai <tiwai@suse.de>
23 Signed-off-by: Sasha Levin <sashal@kernel.org>
24 ---
25 sound/core/pcm_native.c | 8 ++++++++
26 1 file changed, 8 insertions(+)
27
28 diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
29 index b67f6fe08a1b..e08c6c6ca029 100644
30 --- a/sound/core/pcm_native.c
31 +++ b/sound/core/pcm_native.c
32 @@ -1513,6 +1513,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)
33 /* FIXME: the open/close code should lock this as well */
34 if (substream->runtime == NULL)
35 continue;
36 +
37 + /*
38 + * Skip BE dai link PCM's that are internal and may
39 + * not have their substream ops set.
40 + */
41 + if (!substream->ops)
42 + continue;
43 +
44 err = snd_pcm_suspend(substream);
45 if (err < 0 && err != -EBUSY)
46 return err;
47 --
48 2.19.1
49