Skip to contentSkip to conversation

ALSA: core: Call substream ack() method upon compat mmap, commit

PATCH In review Alan Young 2 participants 2 messages Jul 9, 2021 – Jul 12, 2021 Sound

lore
Share & tools
lore

Alan Young

author
#0 lore raw

PATCH 1/1 ALSA: core: Call substream ack() method upon compat mmap, commit

If a 32-bit application is being used with a 64-bit kernel and is using the mmap mechanism to write data, then the SNDRV_PCM_IOCTL_SYNC_PTR ioctl results in calling snd_pcm_ioctl_sync_ptr_compat(). Make this use pcm_lib_apply_appl_ptr() so that the substream's ack() method, if defined, is called.

The snd_pcm_sync_ptr() function, used in the 64-bit ioctl case, already uses snd_pcm_ioctl_sync_ptr_compat().

---
 sound/core/pcm_native.c | 11 ++++++++---

 1 file changed, 8 insertions(+), 3 deletions(-)
sound/core/pcm_native.c +0 -0
index 17a85f4815d5..91a749835ca1 100644
@@ -3057,9 +3057,14 @@ static int snd_pcm_ioctl_sync_ptr_compat(struct snd_pcm_substream *substream,

         boundary = 0x7fffffff; snd_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) {
+            snd_pcm_stream_unlock_irq(substream);
+            return err;
+        }
+    } else
         scontrol.appl_ptr = control->appl_ptr % boundary; if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN)) control->avail_min = scontrol.avail_min;

Signature · 1 line
2.31.1
#1 lore raw
Quoted 11 lines · Alan Young

If a 32-bit application is being used with a 64-bit kernel and is using the mmap mechanism to write data, then the SNDRV_PCM_IOCTL_SYNC_PTR ioctl results in calling snd_pcm_ioctl_sync_ptr_compat(). Make this use pcm_lib_apply_appl_ptr() so that the substream's ack() method, if defined, is called.

The snd_pcm_sync_ptr() function, used in the 64-bit ioctl case, already uses snd_pcm_ioctl_sync_ptr_compat().

A good catch. But unfortunately the posted patch couldn't be applied cleanly. Could you check your MUA setup and resubmit?

thanks,

Takashi