From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A7573A1E96; Sat, 17 Oct 2026 16:57:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256275; cv=none; b=KnPjtyjAFe1tXPDrkTZvYz5MzjX+oor/E5Yp4QafXezQuFAmR8Zt0FFT+EoArWU5CJpVbe0ki4/WcSWg0M/GbmQTc+mV8/Djx8T+9iQrujK6LIUzstfgk5QMmYtmIfNq+I76PspGoZ1zTiGCW6ubofnyl/vec7g9vH6+OsSRCII= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1792256275; c=relaxed/simple; bh=iVwLL4+1fMwFbGEVjG4zJRu1yzGkXNgrRuLms6U9mRM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MCuQRTnppNmN6s2upPK62JO3KSUaJbrXTAKQvA9YAPFV/K4OYdx1TdjzO0wWOmJImWxtI50CANBnrxZLRY9k37vgJt4V6k1y/my5QEF6OAMYXLcUC30XS6R/VbrdfMI7RENSGQ/a0PgU4Z1kKg2NpKZQwytN+q/1Mqw9pv1cWlo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=EQLFSkWH; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b="EQLFSkWH" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8723E1F000C4; Sat, 17 Oct 2026 16:57:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1792256274; bh=xjHLe1Fc8XyDiSecMD6/6j0Iq/1yYPVxLWJ70EVzF2s=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=EQLFSkWHTcw0lGxfLW4Bu3WQsTDfzBeLZp3VN1iLCGVeWhR3sv9jBIXUNbCVUXGyO +7pjPwWC5Lehy4QxphVqAyF4YZIf229vQRGHEJ3Bw9zhlSZ+uS3MJC3NrKS230HNJV wXJzmit5xp7JHGOLOm5VKkQz1wKKzKTOhDWSlQ4M= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, syzbot+2a123f6269da57ffefaa@syzkaller.appspotmail.com, Nguyen Ngoc Thang , Takashi Iwai Subject: [PATCH 6.6 0182/1674] ALSA: caiaq: unregister the input device when probe fails Date: Sat, 17 Oct 2026 17:40:54 +0200 Message-ID: <20261017160435.823436843@linuxfoundation.org> X-Mailer: git-send-email 2.56.0 In-Reply-To: <20261017160431.119607952@linuxfoundation.org> References: <20261017160431.119607952@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore Precedence: bulk X-Mailing-List: patches@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.6-stable review patch. If anyone has any objections, please let me know. ------------------ From: Nguyen Ngoc Thang commit 0b7bd20f6379bc5e431fd74d866390f5b5b63f3c upstream. setup_card() registers the input device, whose name and phys point into struct snd_usb_caiaqdev, and then goes on to snd_card_register() and snd_usb_caiaq_control_init(). If either fails, snd_probe() calls snd_card_free(), which frees the device state but leaves the input device registered: card_free() only clears the pointer, and the input device is unregistered from snd_disconnect() alone. Reading its "uevent" attribute afterwards dereferences freed memory: BUG: KASAN: slab-use-after-free in string+0x4a9/0x4f0 Read of size 1 at addr ffff8880208f5043 by task caiaq/4967 add_uevent_var+0x183/0x3a0 input_dev_uevent+0x162/0x900 dev_uevent+0x2f1/0x870 uevent_show+0x1ca/0x3a0 ... Unregister the input device on the probe error path, as snd_disconnect() does. snd_usb_caiaq_input_disconnect() is a no-op when no input device was registered. Reproduced with a raw-gadget Audio Kontrol 1 and a temporary hack that makes snd_usb_caiaq_control_init() fail. Fixes: 28abd224db4a ("ALSA: caiaq: Handle probe errors properly") Cc: stable@vger.kernel.org Reported-by: syzbot+2a123f6269da57ffefaa@syzkaller.appspotmail.com Closes: https://syzkaller.appspot.com/bug?extid=2a123f6269da57ffefaa Signed-off-by: Nguyen Ngoc Thang Link: https://patch.msgid.link/20260925170717.22462-1-ngocthang2710.1999@gmail.com Signed-off-by: Takashi Iwai Signed-off-by: Greg Kroah-Hartman --- sound/usb/caiaq/device.c | 3 +++ 1 file changed, 3 insertions(+) --- a/sound/usb/caiaq/device.c +++ b/sound/usb/caiaq/device.c @@ -562,6 +562,9 @@ static int snd_probe(struct usb_interfac ret = init_card(caiaqdev(card)); if (ret < 0) { dev_err(&usb_dev->dev, "unable to init card! (ret=%d)\n", ret); +#ifdef CONFIG_SND_USB_CAIAQ_INPUT + snd_usb_caiaq_input_disconnect(caiaqdev(card)); +#endif snd_card_free(card); return ret; }