mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Jiakai Xu <xujiakai24@mails.ucas.ac.cn>
Cc: linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org,
	Jaroslav Kysela <perex@perex.cz>, Kees Cook <kees@kernel.org>,
	Takashi Iwai <tiwai@suse.com>
Subject: Re: [PATCH] ALSA: pcm: Fix NULL dereference in import_ubuf() during exit
Date: Tue, 26 May 2026 07:28:04 +0200	[thread overview]
Message-ID: <871pey210b.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260526013245.785435-1-xujiakai24@mails.ucas.ac.cn>

On Tue, 26 May 2026 03:32:45 +0200,
Jiakai Xu wrote:
> 
> snd_pcm_oss_sync() calls snd_pcm_lib_write(substream, NULL, size) to
> fill silence.  The in_kernel flag is hard-coded to false by the wrapper,
> so do_transfer() falls through to import_ubuf() with a garbage pointer
> (NULL + frame_offset).  When the process is in do_exit() and current->mm
> is already NULL, import_ubuf()'s access_ok() crashes dereferencing 
> mm->context.pmlen.
> 
> Add a NULL guard in do_transfer() to use iov_iter_kvec() with a dummy
> kvec for the fill_silence path, avoiding the import_ubuf() call.  The
> fill_silence transfer function ignores the iov_iter, so the dummy kvec
> is safe.
> 
> Fixes: cf393babb37a1 ("ALSA: pcm: Add copy ops with iov_iter")
> Signed-off-by: Jiakai Xu <xujiakai24@mails.ucas.ac.cn>

This is already fixed by the upstream commit e4d3386b74fb ("ALSA: pcm:
Don't setup bogus iov_iter for silencing").


thanks,

Takashi

      reply	other threads:[~2026-05-26  5:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  1:32 Jiakai Xu
2026-05-26  5:28 ` Takashi Iwai [this message]

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=871pey210b.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=kees@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=xujiakai24@mails.ucas.ac.cn \
    /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

all inboxes | Powered by JetHome®