public inbox for linux-sound@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ALSA: caiaq: fix UAF, double-free, and USB refcount bugs
@ 2026-04-10  4:59 Berk Cem Goksel
  2026-04-10  4:59 ` [PATCH 1/2] ALSA: caiaq: fix use-after-free and double-free in setup_card() Berk Cem Goksel
  2026-04-10  4:59 ` [PATCH 2/2] ALSA: caiaq: take a reference on the USB device in create_card() Berk Cem Goksel
  0 siblings, 2 replies; 5+ messages in thread
From: Berk Cem Goksel @ 2026-04-10  4:59 UTC (permalink / raw)
  To: Takashi Iwai, Jaroslav Kysela
  Cc: linux-sound, linux-kernel, Andrey Konovalov, Berk Cem Goksel

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.

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 | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-04-10  6:31 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-10  4:59 [PATCH 0/2] ALSA: caiaq: fix UAF, double-free, and USB refcount bugs Berk Cem Goksel
2026-04-10  4:59 ` [PATCH 1/2] ALSA: caiaq: fix use-after-free and double-free in setup_card() Berk Cem Goksel
2026-04-10  6:26   ` Takashi Iwai
2026-04-10  4:59 ` [PATCH 2/2] ALSA: caiaq: take a reference on the USB device in create_card() Berk Cem Goksel
2026-04-10  6:31   ` Takashi Iwai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox