From: Takashi Iwai <tiwai@suse.de>
To: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Cc: liam.r.girdwood@linux.intel.com, alsa-devel@alsa-project.org,
broonie@kernel.org, vkoul@kernel.org,
Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Subject: Re: [PATCH] ALSA: PCM: check if ops are defined before suspending PCM
Date: Sat, 09 Feb 2019 10:27:42 +0100 [thread overview]
Message-ID: <s5hwom971m9.wl-tiwai@suse.de> (raw)
In-Reply-To: <20190208232953.7266-1-pierre-louis.bossart@linux.intel.com>
On Sat, 09 Feb 2019 00:29:53 +0100,
Pierre-Louis Bossart wrote:
>
> From: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
>
> 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.
>
> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
> ---
> sound/core/pcm_native.c | 8 ++++++++
> 1 file changed, 8 insertions(+)
>
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index 818dff1de545..b6e158ce6650 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -1506,6 +1506,14 @@ int snd_pcm_suspend_all(struct snd_pcm *pcm)
> /* FIXME: the open/close code should lock this as well */
> if (substream->runtime == NULL)
> 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);
> if (err < 0 && err != -EBUSY)
> return err;
Basically it's OK and safe to apply this check. We may need to add
such sanity checks in more places if this really hits.
But I still wonder how this can go through. Is substream->runtime set
even if substream->ops is NULL? The substream->runtime is assigned
dynamically at opening a substream via snd_pcm_attach_substream(), so
without opening it, it must be NULL.
thanks,
Takashi
next prev parent reply other threads:[~2019-02-09 9:27 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-02-08 23:29 [PATCH] ALSA: PCM: check if ops are defined before suspending PCM Pierre-Louis Bossart
2019-02-09 9:27 ` Takashi Iwai [this message]
2019-02-11 15:41 ` Pierre-Louis Bossart
2019-02-11 16:05 ` Takashi Iwai
2019-02-11 16:59 ` Pierre-Louis Bossart
2019-02-12 16:20 ` Mark Brown
2019-02-12 20:48 ` Ranjani Sridharan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=s5hwom971m9.wl-tiwai@suse.de \
--to=tiwai@suse.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@kernel.org \
--cc=liam.r.girdwood@linux.intel.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=ranjani.sridharan@linux.intel.com \
--cc=vkoul@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.