Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 3674f19d authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Takashi Iwai
Browse files

ALSA: vmalloc buffers should use normal mmap



It's a big no-no to use pgprot_noncached() when mmap'ing such buffers
into userspace since they are mapped cachable in kernel space.

This can cause all sort of interesting things ranging from to garbled
sound to lockups on various architectures. I've observed that usb-audio
is broken on powerpc 4xx for example because of that.

Also remove the now unused snd_pcm_lib_mmap_noncached(). It's
an arch business to know when to use uncached mappings, there's
already hacks for MIPS inside snd_pcm_default_mmap() and other
archs are supposed to use dma_mmap_coherent().

(See my separate patch that adds dma_mmap_coherent() to powerpc)

Signed-off-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
CC: <stable@kernel.org>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 20b67ddd
Loading
Loading
Loading
Loading
+1 −3
Original line number Original line Diff line number Diff line
@@ -1031,9 +1031,7 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream, struct vm_area_s
#define snd_pcm_lib_mmap_iomem	NULL
#define snd_pcm_lib_mmap_iomem	NULL
#endif
#endif


int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
#define snd_pcm_lib_mmap_vmalloc NULL
			       struct vm_area_struct *area);
#define snd_pcm_lib_mmap_vmalloc	snd_pcm_lib_mmap_noncached


static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
static inline void snd_pcm_limit_isa_dma_size(int dma, size_t *max)
{
{
+0 −9
Original line number Original line Diff line number Diff line
@@ -3201,15 +3201,6 @@ int snd_pcm_lib_mmap_iomem(struct snd_pcm_substream *substream,
EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);
EXPORT_SYMBOL(snd_pcm_lib_mmap_iomem);
#endif /* SNDRV_PCM_INFO_MMAP */
#endif /* SNDRV_PCM_INFO_MMAP */


/* mmap callback with pgprot_noncached */
int snd_pcm_lib_mmap_noncached(struct snd_pcm_substream *substream,
			       struct vm_area_struct *area)
{
	area->vm_page_prot = pgprot_noncached(area->vm_page_prot);
	return snd_pcm_default_mmap(substream, area);
}
EXPORT_SYMBOL(snd_pcm_lib_mmap_noncached);

/*
/*
 * mmap DMA buffer
 * mmap DMA buffer
 */
 */