* [PATCH] ALSA: pcm: Use pcm_lib_apply_appl_ptr() in x32 sync_ptr
@ 2026-03-21 23:02 Cássio Gabriel
2026-03-27 11:39 ` Takashi Iwai
0 siblings, 1 reply; 2+ messages in thread
From: Cássio Gabriel @ 2026-03-21 23:02 UTC (permalink / raw)
To: Takashi Iwai
Cc: Jaroslav Kysela, linux-sound, linux-kernel, Cássio Gabriel
snd_pcm_ioctl_sync_ptr_x32() still handles incoming appl_ptr updates
differently from the other SYNC_PTR paths. The native handler and the
32-bit compat handler both pass appl_ptr through pcm_lib_apply_appl_ptr(),
but the x32 handler still writes control->appl_ptr directly.
That direct assignment skips the common appl_ptr validation against
runtime->boundary and also bypasses the substream ack() callback.
This makes the x32 ioctl path behave differently from the native and
compat32 cases, and it can miss the driver notification that explicit
appl_ptr synchronization relies on.
Use pcm_lib_apply_appl_ptr() for x32 too, so appl_ptr updates are
validated consistently and drivers relying on ack() notifications
see the same behavior.
Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
---
sound/core/pcm_compat.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index e71f393d3b01..5313f50f17da 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -430,11 +430,13 @@ static int snd_pcm_ioctl_sync_ptr_x32(struct snd_pcm_substream *substream,
if (!boundary)
boundary = 0x7fffffff;
scoped_guard(pcm_stream_lock_irq, substream) {
- /* FIXME: we should consider the boundary for the sync from app */
- if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL))
- control->appl_ptr = scontrol.appl_ptr;
- else
+ if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) {
+ err = pcm_lib_apply_appl_ptr(substream, scontrol.appl_ptr);
+ if (err < 0)
+ return err;
+ } else {
scontrol.appl_ptr = control->appl_ptr % boundary;
+ }
if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN))
control->avail_min = scontrol.avail_min;
else
---
base-commit: b3c48fa1fb397b490101785ddd87caf2e5513a66
change-id: 20260321-alsa-pcm-x32-sync-ptr-6658bc625482
Best regards,
--
Cássio Gabriel <cassiogabrielcontato@gmail.com>
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] ALSA: pcm: Use pcm_lib_apply_appl_ptr() in x32 sync_ptr
2026-03-21 23:02 [PATCH] ALSA: pcm: Use pcm_lib_apply_appl_ptr() in x32 sync_ptr Cássio Gabriel
@ 2026-03-27 11:39 ` Takashi Iwai
0 siblings, 0 replies; 2+ messages in thread
From: Takashi Iwai @ 2026-03-27 11:39 UTC (permalink / raw)
To: Cássio Gabriel
Cc: Takashi Iwai, Jaroslav Kysela, linux-sound, linux-kernel
On Sun, 22 Mar 2026 00:02:21 +0100,
Cássio Gabriel wrote:
>
> snd_pcm_ioctl_sync_ptr_x32() still handles incoming appl_ptr updates
> differently from the other SYNC_PTR paths. The native handler and the
> 32-bit compat handler both pass appl_ptr through pcm_lib_apply_appl_ptr(),
> but the x32 handler still writes control->appl_ptr directly.
>
> That direct assignment skips the common appl_ptr validation against
> runtime->boundary and also bypasses the substream ack() callback.
> This makes the x32 ioctl path behave differently from the native and
> compat32 cases, and it can miss the driver notification that explicit
> appl_ptr synchronization relies on.
>
> Use pcm_lib_apply_appl_ptr() for x32 too, so appl_ptr updates are
> validated consistently and drivers relying on ack() notifications
> see the same behavior.
>
> Signed-off-by: Cássio Gabriel <cassiogabrielcontato@gmail.com>
Thanks, applied to for-next branch now.
Takashi
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-03-27 11:39 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-03-21 23:02 [PATCH] ALSA: pcm: Use pcm_lib_apply_appl_ptr() in x32 sync_ptr Cássio Gabriel
2026-03-27 11:39 ` Takashi Iwai
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®