Skip to content

Commit 431e311

Browse files
awygregkh
authored andcommitted
ALSA: pcm: Call substream ack() method upon compat mmap commit
commit 2e28325 upstream. 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(). Fixes: 9027c46 ("ALSA: pcm: Call ack() whenever appl_ptr is updated") Signed-off-by: Alan Young <consult.awy@gmail.com> Cc: <stable@vger.kernel.org> Link: https://lore.kernel.org/r/c441f18c-eb2a-3bdd-299a-696ccca2de9c@gmail.com Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 3c9afa2 commit 431e311

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

‎sound/core/pcm_native.c‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3062,9 +3062,14 @@ static int snd_pcm_ioctl_sync_ptr_compat(struct snd_pcm_substream *substream,
30623062
boundary = 0x7fffffff;
30633063
snd_pcm_stream_lock_irq(substream);
30643064
/* FIXME: we should consider the boundary for the sync from app */
3065-
if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL))
3066-
control->appl_ptr = scontrol.appl_ptr;
3067-
else
3065+
if (!(sflags & SNDRV_PCM_SYNC_PTR_APPL)) {
3066+
err = pcm_lib_apply_appl_ptr(substream,
3067+
scontrol.appl_ptr);
3068+
if (err < 0) {
3069+
snd_pcm_stream_unlock_irq(substream);
3070+
return err;
3071+
}
3072+
} else
30683073
scontrol.appl_ptr = control->appl_ptr % boundary;
30693074
if (!(sflags & SNDRV_PCM_SYNC_PTR_AVAIL_MIN))
30703075
control->avail_min = scontrol.avail_min;

0 commit comments

Comments
 (0)