From: Berk Cem Goksel <berkcgoksel@gmail.com>
To: zonque@gmail.com, tiwai@suse.com, perex@perex.cz
Cc: linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org,
andreyknvl@gmail.com, stable@vger.kernel.org,
Berk Cem Goksel <berkcgoksel@gmail.com>
Subject: [PATCH v2 0/2] ALSA: caiaq: fix UAF, double-free, and USB refcount bugs
Date: Mon, 13 Apr 2026 06:49:39 +0300 [thread overview]
Message-ID: <20260413034941.1131465-1-berkcgoksel@gmail.com> (raw)
This series fixes two bugs in the caiaq USB sound driver, both
reachable via a malformed or malicious USB device using
raw-gadget + dummy_hcd.
Patch 1 adds a missing return after snd_card_free() in setup_card()
when snd_card_register() fails. Without it, execution falls through
to snd_usb_caiaq_control_init() on a freed card (use-after-free),
and the caller then leaves the freed pointer in usb_set_intfdata(),
producing a double-free on disconnect.
Patch 2 takes a proper reference on the parent USB device in
create_card() with usb_get_dev() and drops it with usb_put_dev()
in the private_free callback. It also removes a usb_reset_device()
call from that callback, which was both racing against an
already-freed usb_device and inappropriate in a teardown path.
A related stack out-of-bounds read in init_card() was sent
separately and has already been applied; this series is the
remainder of that investigation.
Tested on 7.0.0-rc5 arm64 with KASAN and lockdep enabled.
Reproducers require CONFIG_USB_RAW_GADGET and CONFIG_USB_DUMMY_HCD
and are available on request.
Changes in v2:
- Correct "Fixes:" tags on both patches
- Remove null check before the usb_put_dev() call in card_free()
Berk Cem Goksel (2):
ALSA: caiaq: fix use-after-free and double-free in setup_card()
ALSA: caiaq: take a reference on the USB device in create_card()
sound/usb/caiaq/device.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
--
2.34.1
next reply other threads:[~2026-04-13 3:50 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-13 3:49 Berk Cem Goksel [this message]
2026-04-13 3:49 ` [PATCH v2 1/2] ALSA: caiaq: fix use-after-free and double-free in setup_card() Berk Cem Goksel
2026-04-14 10:56 ` Takashi Iwai
2026-04-13 3:49 ` [PATCH v2 2/2] ALSA: caiaq: take a reference on the USB device in create_card() Berk Cem Goksel
2026-04-13 5:33 ` Takashi Iwai
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=20260413034941.1131465-1-berkcgoksel@gmail.com \
--to=berkcgoksel@gmail.com \
--cc=andreyknvl@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 \
--cc=zonque@gmail.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