Thank you for your contribution! Sashiko AI review found 1 potential issue(s) 
to consider:
- [High] alsa/virtio: !is_vmalloc_addr check breaks NOMMU support
--

commit 011a5cf5cd03694cab8083a5256df199dd8e906f
Author: Joonho Lee <[email protected]>

ALSA: virtio: Retain PCM DMA pages until messages are freed

This patch takes a reference to each page backing the PCM buffer before
building the I/O scatterlists, releasing them only when the messages are
freed. This prevents late device DMA from accessing pages that the
allocator could reuse after ALSA releases the vmalloc mapping.

> diff --git a/sound/virtio/virtio_pcm_msg.c b/sound/virtio/virtio_pcm_msg.c
> index 5371f4985fd06..46bf4df65974f 100644
> --- a/sound/virtio/virtio_pcm_msg.c
> +++ b/sound/virtio/virtio_pcm_msg.c
[ ... ]
> +static int virtsnd_pcm_dma_pages_get(struct virtio_pcm_substream *vss,
> +                                  u8 *data, size_t length)
> +{
> +     size_t i;
> +     size_t npages;
> +     size_t span;
> +
> +     if (!data || !length || !is_vmalloc_addr(data))
> +             return -EINVAL;

[Severity: High]
Does this check break NOMMU architecture support?

The VirtIO sound driver uses SNDRV_DMA_TYPE_VMALLOC for its PCM buffers.
On NOMMU architectures, vmalloc() typically falls back to kmalloc(), and
is_vmalloc_addr() unconditionally returns false.

Because of this, the new is_vmalloc_addr() check in
virtsnd_pcm_dma_pages_get() will unconditionally fail with -EINVAL on NOMMU
systems, preventing the allocation of PCM messages and breaking audio
playback and capture.

Prior to this patch, vmalloc_to_page() was called directly without this
check, which safely translates the kmalloc address via virt_to_page() on
NOMMU. Can this validation be adjusted to support NOMMU configurations?

-- 
Sashiko AI review ยท 
https://sashiko.dev/#/patchset/[email protected]?part=4

Reply via email to