Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Ahmed Abdelmoemen <ahmedabdelmoumen05@gmail.com>
Cc: tiwai@suse.com, perex@perex.cz, linux-sound@vger.kernel.org,
	linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH 1/3] ALSA: pcm: Remove is_oss_stream() bypass of mmap_count check
Date: Wed, 02 Dec 2026 15:20:33 +0100	[thread overview]
Message-ID: <87se0fwyq6.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261202140117.1164633-2-ahmedabdelmoumen05@gmail.com>

On Wed, 02 Dec 2026 15:01:15 +0100,
Ahmed Abdelmoemen wrote:
> 
> hw_params_state_check() skips the mmap_count guard for OSS streams via
> the is_oss_stream() condition. This lets hw_params run while userspace
> holds a live VM_PFNMAP mapping obtained through /dev/dsp.
> 
> remap_pfn_range() mappings (VM_PFNMAP) carry no page reference counts,
> so the kernel cannot revoke them when hw_params reconfigures or
> reallocates the DMA buffer. The buffer can be cleared or freed while
> userspace retains read/write access to it.
> 
> Removing the bypass restores the intended safety invariant: an OSS
> caller holding a mapping gets -EBADFD on reconfiguration, the same as a
> native PCM stream. Reconfiguring the buffer under an active mapping is
> never safe regardless of stream type.
> 
> Fixes: 92ee3c60ec9f ("ALSA: pcm: Fix races among concurrent hw_params and hw_free calls")
> Cc: stable@vger.kernel.org
> Signed-off-by: Ahmed Abdelmoemen <ahmedabdelmoumen05@gmail.com>

The same fix is already on sound.git tree for-next branch.


thanks,

Takashi

  reply	other threads:[~2026-12-02 14:20 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 14:01 [PATCH 0/3] ALSA: pcm: Fix OSS mmap buffer-lifetime issues Ahmed Abdelmoemen
2026-12-02 14:01 ` [PATCH 1/3] ALSA: pcm: Remove is_oss_stream() bypass of mmap_count check Ahmed Abdelmoemen
2026-12-02 14:20   ` Takashi Iwai [this message]
2026-12-02 14:21   ` sashiko-bot
2026-12-02 14:01 ` [PATCH 2/3] ALSA: pcm: Check mmap_count before freeing buffer in error path Ahmed Abdelmoemen
2026-12-02 14:16   ` sashiko-bot
2026-12-02 14:01 ` [PATCH 3/3] ALSA: pcm: Clear mmap tail padding to avoid info leak Ahmed Abdelmoemen

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=87se0fwyq6.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=ahmedabdelmoumen05@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.com \
    /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