All of lore.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Hanxiang Xu <xuhx@hust.edu.cn>
Cc: Takashi Iwai <tiwai@suse.com>, Jaroslav Kysela <perex@perex.cz>,
	linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] ALSA: emux: expose the hwdep device only after ports are initialized
Date: Wed, 02 Dec 2026 10:01:18 +0100	[thread overview]
Message-ID: <87fqwgxdi9.wl-tiwai@suse.de> (raw)
In-Reply-To: <20261202101302.1-1-xuhx@hust.edu.cn>

On Wed, 02 Dec 2026 03:13:02 +0100,
Hanxiang Xu wrote:
> 
> snd_emux_register() creates and registers the hwdep device
> (snd_emux_init_hwdep() -> snd_card_register()) before
> snd_emux_init_seq() fills emu->portptrs[], and ignores the init_seq()
> return value.  A SNDRV_EMUX_IOCTL_MISC_MODE ioctl arriving inside that
> window walks emu->portptrs[i]->ctrls[] with portptrs[i] == NULL and
> causes a near-NULL kernel write (dynamically confirmed on v7.4-rc5);
> a failed sequencer setup additionally leaves the already-registered
> hwdep behind for the probe error path to free with possibly-open fds.
> 
> Initialize the ports (and OSS/virmidi) first and create the hwdep
> device last, so the device only becomes visible to userspace after
> everything its ioctls touch is initialized, and propagate the
> snd_emux_init_seq() error.
> 
> Cc: <stable@vger.kernel.org>
> Signed-off-by: Hanxiang Xu <xuhx@hust.edu.cn>

Applied to for-next branch.  Thanks.


Takashi

      reply	other threads:[~2026-12-02  9:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  2:13 [PATCH] ALSA: emux: expose the hwdep device only after ports are initialized Hanxiang Xu
2026-12-02  9:01 ` 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=87fqwgxdi9.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=tiwai@suse.com \
    --cc=xuhx@hust.edu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.