All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ALSA: pcm: update state after xrun
@ 2026-10-27 13:12 Mikael Magnusson
  2026-10-27 13:23 ` sashiko-bot
  2026-10-27 14:50 ` Takashi Iwai
  0 siblings, 2 replies; 4+ messages in thread
From: Mikael Magnusson @ 2026-10-27 13:12 UTC (permalink / raw)
  To: linux-sound; +Cc: Takashi Iwai

If the snd_pcm_update_hw_ptr call from snd_pcm_status is what triggers
the xrun state (eg, as opposed to an IRQ), the returned status->state
was stale and told userspace the device was still playing, so they could
get confused about device state and hang indefinitely.

Closes: https://bugzilla.kernel.org/show_bug.cgi?id=222201
Signed-off-by: Mikael Magnusson <mikachu@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 35152fae74..62a2bea043 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1132,6 +1132,9 @@ int snd_pcm_status64(struct snd_pcm_substream *substream,
 	status->trigger_tstamp_nsec = runtime->trigger_tstamp.tv_nsec;
 	if (snd_pcm_running(substream)) {
 		snd_pcm_update_hw_ptr(substream);
+		/* update_hw_ptr may have put us in xrun state, update state */
+		status->state = runtime->state;
+		status->suspended_state = runtime->suspended_state;
 		if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) {
 			status->tstamp_sec = runtime->status->tstamp.tv_sec;
 			status->tstamp_nsec =

base-commit: d135ab453a7400a34930bdda1ef4bdc8acfac80e
-- 
2.38.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-10-27 17:18 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-27 13:12 [PATCH] ALSA: pcm: update state after xrun Mikael Magnusson
2026-10-27 13:23 ` sashiko-bot
2026-10-27 14:50 ` Takashi Iwai
2026-10-27 17:18   ` Mikael Magnusson

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.