From: Takashi Iwai Date: Mon, 4 Nov 2019 10:11:15 +0000 (+0100) Subject: ALSA: pcm: Fix missing check of the new non-cached buffer type X-Git-Tag: Ubuntu-5.3.0-40.32~253 X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=541c7378cbf7970ec511762b4b034fff216af9a4;p=mirror_ubuntu-eoan-kernel.git ALSA: pcm: Fix missing check of the new non-cached buffer type BugLink: https://bugs.launchpad.net/bugs/1860490 [ Upstream commit 6111fd2370eecae9f11bfdc08ba097e0b51fcfd3 ] The check for the mmap support via hw_support_mmap() function misses the case where the device is with SNDRV_DMA_TYPE_DEV_UC, which should have been treated equally as SNDRV_DMA_TYPE_DEV. Let's fix it. Note that this bug doesn't hit any practical problem, because SNDRV_DMA_TYPE_DEV_UC is used only for x86-specific drivers (snd-hda-intel and snd-intel8x0) for the specific platforms that need the non-cached buffers. And, on such platforms, hw_support_mmap() already returns true in anyway. That's the reason I didn't put Cc-to-stable mark here. This is only for any theoretical future extension. Fixes: 425da159707b ("ALSA: pcm: use dma_can_mmap() to check if a device supports dma_mmap_*") Fixes: 42e748a0b325 ("ALSA: memalloc: Add non-cached buffer type") Link: https://lore.kernel.org/r/20191104101115.27311-1-tiwai@suse.de Signed-off-by: Takashi Iwai Signed-off-by: Sasha Levin Signed-off-by: Kamal Mostafa Signed-off-by: Khalid Elmously --- diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c index 38541322ccec..86700fce0752 100644 --- a/sound/core/pcm_native.c +++ b/sound/core/pcm_native.c @@ -223,7 +223,8 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream) /* architecture supports dma_mmap_coherent()? */ #if defined(CONFIG_ARCH_NO_COHERENT_DMA_MMAP) || !defined(CONFIG_HAS_DMA) if (!substream->ops->mmap && - substream->dma_buffer.dev.type == SNDRV_DMA_TYPE_DEV) + (substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV && + substream->dma_buffer.dev.type != SNDRV_DMA_TYPE_DEV_UC)) return false; #endif return true;