Linux virtualization list
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Joonho Lee" <mynameisjune111@gmail.com>
Cc: virtualization@lists.linux.dev,
	"Michael S. Tsirkin" <mst@redhat.com>,
	"Eugenio Perez" <eperezma@redhat.com>
Subject: Re: [PATCH v1 4/5] ALSA: virtio: Retain PCM DMA pages until messages are freed
Date: Tue, 13 Oct 2026 05:39:48 +0000	[thread overview]
Message-ID: <sashiko-outbox-169000@kernel.org> (raw)
In-Reply-To: <6b6421f719a49ce0195c3d43f58b50e40a6e9347.1791867377.git.mynameisjune111@gmail.com>

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 <mynameisjune111@gmail.com>

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/cover.1791867377.git.mynameisjune111@gmail.com?part=4

  reply	other threads:[~2026-10-13  5:39 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-13  5:30 [PATCH v1 0/5] ALSA: virtio: Fix request lifetime and error recovery Joonho Lee
2026-10-13  5:30 ` [PATCH v1 1/5] ALSA: virtio: Notify queued PCM messages after send errors Joonho Lee
2026-10-13  5:40   ` sashiko-bot
2026-10-13  5:30 ` [PATCH v1 2/5] ALSA: virtio: Recover PCM state after a failed start Joonho Lee
2026-10-13  5:42   ` sashiko-bot
2026-10-13  5:30 ` [PATCH v1 3/5] ALSA: virtio: Retain control requests through device reset Joonho Lee
2026-10-13  5:43   ` sashiko-bot
2026-10-13  5:30 ` [PATCH v1 4/5] ALSA: virtio: Retain PCM DMA pages until messages are freed Joonho Lee
2026-10-13  5:39   ` sashiko-bot [this message]
2026-10-13  5:30 ` [PATCH v1 5/5] ALSA: virtio: Keep control payloads in refcounted messages Joonho Lee
2026-10-13  5:39   ` sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-169000@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=eperezma@redhat.com \
    --cc=mst@redhat.com \
    --cc=mynameisjune111@gmail.com \
    --cc=sashiko-reviews@lists.linux.dev \
    --cc=virtualization@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox