Re: [PATCH] ALSA: us122l: mark hwdep mappings VM_MIXEDMAP
From: Takashi Iwai
Date: Fri Oct 23 2026 - 09:36:15 EST
On Fri, 23 Oct 2026 12:21:31 +0200,
Lorenzo Stoakes (ARM) wrote:
>
> mm has recently moved to a strict model which requires any driver which
> clears VMA_MAYWRITE_BIT to be mapping non-mm-managed memory
> (VMA_PFNMAP_BIT or VMA_MIXEDMAP_BIT), failing any such mmap() with an
> error and a kernel warning - see "mm/vma: only allow mmap to clear
> VMA_MAYWRITE_BIT if not mm-managed".
>
> However, simultaneous to this, commit 71c610aeb177 ("ALSA: us122l: Prevent
> write upgrades for read mappings") updated us122l to clear
> VMA_MAYWRITE_BIT without marking the region with either VMA_PFNMAP_BIT or
> VMA_MIXEDMAP_BIT.
>
> vm_insert_pages() and friends set this automatically, however this driver
> maps its pre-allocated pages from a fault handler, so never calls these.
>
> Simply set the flag in usb_stream_hwdep_mmap() to resolve the issue. This
> correctly marks the mapping as one whose pages core mm does not manage,
> which has no meaningful impact for this driver beyond preventing the mmap()
> from failing.
>
> Fixes: 71c610aeb177 ("ALSA: us122l: Prevent write upgrades for read mappings")
> Reported-by: David Carlier <devnexen@xxxxxxxxx>
> Closes: https://lore.kernel.org/20261018025905.201296-1-devnexen@xxxxxxxxx
> Cc: Kazuki Hanai <hnkz.64@xxxxxxxxx>
> Cc: Takashi Iwai <tiwai@xxxxxxxx>
> Cc: Jaroslav Kysela <perex@xxxxxxxx>
> Signed-off-by: Lorenzo Stoakes (ARM) <ljs@xxxxxxxxxx>
> ---
> Andrew - I think easiest for you to take this.
>
> It should go in before my series ideally to avoid bisection hazard, I think
> while it's a fix for the driver, that'll be the safest way.
Yes, feel free to take:
Acked-by: Takashi Iwai <tiwai@xxxxxxx>
thanks,
Takashi