[PATCH] ALSA: pcm: Fix mmap capability check
Takashi Iwai
tiwai at suse.de
Fri Jul 30 09:42:23 CEST 2021
On Fri, 30 Jul 2021 09:19:16 +0200,
Jaroslav Kysela wrote:
>
> On 20. 07. 21 11:26, Takashi Iwai wrote:
> > The hw_support_mmap() doesn't cover all memory allocation types and
> > might use a wrong device pointer for checking the capability.
> > Check the all memory allocation types more completely.
>
> This change breaks mmap for the snd-dummy driver (fake_buffer). It seems that
> we need this fix?
>
> diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
> index 6a2971a7e6a1..09c0e2a6489c 100644
> --- a/sound/core/pcm_native.c
> +++ b/sound/core/pcm_native.c
> @@ -246,7 +246,7 @@ static bool hw_support_mmap(struct snd_pcm_substream
> *substream)
> if (!(substream->runtime->hw.info & SNDRV_PCM_INFO_MMAP))
> return false;
>
> - if (substream->ops->mmap)
> + if (substream->ops->mmap || substream->ops->page)
> return true;
>
> switch (substream->dma_buffer.dev.type) {
Yes, that would work. Or allowing the mmap for unknown buffer type by
blindly relying to the hw.info flag. But ops->page check looks
safer.
Care to submit a proper patch? Thanks!
Takashi
More information about the Alsa-devel
mailing list