From: Soham Kute <officialsohamkute@gmail.com>
To: tiwai@suse.com
Cc: perex@perex.cz, linux-sound@vger.kernel.org,
linux-kernel@vger.kernel.org,
Soham Kute <officialsohamkute@gmail.com>,
syzbot+16b2b67ae905feb8a289@syzkaller.appspotmail.com
Subject: [PATCH] ALSA: pcm: prevent snd_pcm_action after substream detach
Date: Mon, 9 Feb 2026 00:23:40 +0530 [thread overview]
Message-ID: <20260208185340.8379-1-officialsohamkute@gmail.com> (raw)
syzbot reported a slab use-after-free in snd_pcm_post_stop() caused by
snd_pcm_action() being invoked after snd_pcm_detach_substream() has
already freed the PCM runtime.
The previous approach attempted to guard against NULL runtime access in
the post-action callback, which only masked the symptom. As pointed out
in review, this does not address the underlying lifetime issue.
Fix the root cause by preventing snd_pcm_action() from running once the
substream runtime has been detached, ensuring that no PCM actions are
executed after teardown.
Reported-by: syzbot+16b2b67ae905feb8a289@syzkaller.appspotmail.com
Signed-off-by: Soham Kute <officialsohamkute@gmail.com>
---
sound/core/pcm_native.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 932a9bf98..a29dbbc21 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1391,6 +1391,9 @@ static int snd_pcm_action(const struct action_ops *ops,
struct snd_pcm_group *group;
int res;
+ if (WARN_ON_ONCE(!substream->runtime))
+ return 0;
+
group = snd_pcm_stream_group_ref(substream);
if (group)
res = snd_pcm_action_group(ops, substream, state, true);
--
2.34.1
next reply other threads:[~2026-02-08 18:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-08 18:53 Soham Kute [this message]
2026-02-09 9:34 ` Takashi Iwai
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=20260208185340.8379-1-officialsohamkute@gmail.com \
--to=officialsohamkute@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sound@vger.kernel.org \
--cc=perex@perex.cz \
--cc=syzbot+16b2b67ae905feb8a289@syzkaller.appspotmail.com \
--cc=tiwai@suse.com \
/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®