public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Berk Cem Goksel <berkcgoksel@gmail.com>
Cc: tiwai@suse.com, perex@perex.cz, linux-sound@vger.kernel.org,
	stable@vger.kernel.org, andreyknvl@gmail.com
Subject: Re: [PATCH] ALSA: usb-audio: Fix use-after-free in snd_usb_mixer_free()
Date: Tue, 20 Jan 2026 12:44:35 +0100	[thread overview]
Message-ID: <87cy34tsnw.wl-tiwai@suse.de> (raw)
In-Reply-To: <20260120102855.7300-1-berkcgoksel@gmail.com>

On Tue, 20 Jan 2026 11:28:55 +0100,
Berk Cem Goksel wrote:
> 
> When snd_usb_create_mixer() fails, snd_usb_mixer_free() frees
> mixer->id_elems but the controls already added to the card still
> reference the freed memory. Later when snd_card_register() runs,
> the OSS mixer layer calls their callbacks and hits a use-after-free read.
> 
> Call trace:
>   get_ctl_value+0x63f/0x820 sound/usb/mixer.c:411
>   get_min_max_with_quirks.isra.0+0x240/0x1f40 sound/usb/mixer.c:1241
>   mixer_ctl_feature_info+0x26b/0x490 sound/usb/mixer.c:1381
>   snd_mixer_oss_build_test+0x174/0x3a0 sound/core/oss/mixer_oss.c:887
>   ...
>   snd_card_register+0x4ed/0x6d0 sound/core/init.c:923
>   usb_audio_probe+0x5ef/0x2a90 sound/usb/card.c:1025
> 
> Fix by calling snd_ctl_remove() for all mixer controls before freeing
> id_elems. We save the next pointer first because snd_ctl_remove()
> frees the current element.
> 
> Fixes: 6639b6c2367f ("[ALSA] usb-audio - add mixer control notifications")
> Cc: stable@vger.kernel.org
> Cc: Andrey Konovalov <andreyknvl@gmail.com>
> Signed-off-by: Berk Cem Goksel <berkcgoksel@gmail.com>

Thanks, applied now.


Takashi

      reply	other threads:[~2026-01-20 11:44 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-20 10:28 [PATCH] ALSA: usb-audio: Fix use-after-free in snd_usb_mixer_free() Berk Cem Goksel
2026-01-20 11:44 ` 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=87cy34tsnw.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=andreyknvl@gmail.com \
    --cc=berkcgoksel@gmail.com \
    --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