Commit 62ecc64c authored by Ranjani Sridharan's avatar Ranjani Sridharan Committed by Greg Kroah-Hartman

ALSA: PCM: check if ops are defined before suspending PCM

[ Upstream commit d9c0b2af ]

BE dai links only have internal PCM's and their substream ops may
not be set. Suspending these PCM's will result in their
 ops->trigger() being invoked and cause a kernel oops.
So skip suspending PCM's if their ops are NULL.

[ NOTE: this change is required now for following the recent PCM core
  change to get rid of snd_pcm_suspend() call.  Since DPCM BE takes
  the runtime carried from FE while keeping NULL ops, it can hit this
  bug.  See details at:
     https://github.com/thesofproject/linux/pull/582
  -- tiwai ]
Signed-off-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 416b593a
...@@ -1482,6 +1482,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm) ...@@ -1482,6 +1482,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)
/* FIXME: the open/close code should lock this as well */ /* FIXME: the open/close code should lock this as well */
if (substream->runtime == NULL) if (substream->runtime == NULL)
continue; continue;
/*
* Skip BE dai link PCM's that are internal and may
* not have their substream ops set.
*/
if (!substream->ops)
continue;
err = snd_pcm_suspend(substream); err = snd_pcm_suspend(substream);
if (err < 0 && err != -EBUSY) if (err < 0 && err != -EBUSY)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment