From: "Cássio Gabriel Monteiro Pires" <cassiogabrielcontato@gmail.com>
To: Takashi Iwai <tiwai@suse.de>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: pcm: Serialize snd_pcm_suspend_all() with open_mutex
Date: Fri, 27 Mar 2026 09:28:36 -0300 [thread overview]
Message-ID: <598871fe-b82e-4d51-9886-8c16dc68ed6a@gmail.com> (raw)
In-Reply-To: <87se9lqz8k.wl-tiwai@suse.de>
On 3/27/26 08:38, Takashi Iwai wrote:
>> walks all PCM substreams and uses a lockless
>> runtime check to skip closed streams. It then calls snd_pcm_suspend()
>> for each remaining substream and finally runs snd_pcm_sync_stop() in a
>> second pass.
>>
>> The runtime lifetime is still controlled by pcm->open_mutex in the
>> open/release path. That means a concurrent close can clear or free
>> substream->runtime after the initial check in snd_pcm_suspend_all(),
>> leaving the later suspend or sync-stop path to dereference a stale or
>> NULL runtime pointer.
>>
>> Serialize snd_pcm_suspend_all() with pcm->open_mutex so the runtime
>> pointer stays stable across both loops. This matches the existing PCM
>> runtime lifetime rule already used by other core paths that access
>> substream->runtime outside the stream lock.
>>
>> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
> I guess it's safe to take open_mutex from this function, but it's
> still worth to mention it in the function description.
> Could you update the description of snd_pcm_suspend_all(), too?
>
Yes, I'll do it and send the v2 patch.
--
Thanks,
Cássio
prev parent reply other threads:[~2026-03-27 12:28 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 17:28 Cássio Gabriel
2026-03-27 11:38 ` Takashi Iwai
2026-03-27 12:28 ` Cássio Gabriel Monteiro Pires [this message]
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=598871fe-b82e-4d51-9886-8c16dc68ed6a@gmail.com \
--to=cassiogabrielcontato@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=tiwai@suse.com \
--cc=tiwai@suse.de \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®