projects/linux·commit dc0dc8a7

ALSA: pcm: Fix mmap breakage without explicit buffer setup

dc0dc8a7 · Takashi Iwai <[email protected]> · 2021-08-08 09:01:16 +02:00

The recent fix c4824ae7db41 ("ALSA: pcm: Fix mmap capability check")
restricts the mmap capability only to the drivers that properly set up
the buffers, but it caused a regression for a few drivers that manage
the buffer on its own way.

For those with UNKNOWN buffer type (i.e. the uninitialized / unused
substream->dma_buffer), just assume that the driver handles the mmap
properly and blindly trust the hardware info bit.

Fixes: c4824ae7db41 ("ALSA: pcm: Fix mmap capability check")
Reported-and-tested-by: Jeff Woods <[email protected]>
Cc: <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Takashi Iwai <[email protected]>
Commit
dc0dc8a73e8e4dc33fba93dfe23356cc5a500c57
Parents
739d0959

Changes

1 files changed · +4 −1

FileStatusAddDelContent
sound/core/pcm_native.cmodified+4−1View file

sound/core/pcm_native.c

View file
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 09c0e2a..71323d8 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -251,7 +251,10 @@ static bool hw_support_mmap(struct snd_pcm_substream *substream)
switch (substream->dma_buffer.dev.type) {
case SNDRV_DMA_TYPE_UNKNOWN:
- return false;
+ /* we can't know the device, so just assume that the driver does
+ * everything right
+ */
+ return true;
case SNDRV_DMA_TYPE_CONTINUOUS:
case SNDRV_DMA_TYPE_VMALLOC:
return true;