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 B2DBD40A954; Thu, 16 Jul 2026 14:23:49 +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=1784211831; cv=none; b=aIUoz2vt1XW3Dr2MZOS5f9VJp+sgvvg++99wTSe2b/08YP9pErfvkUYkgg819g1J8xzrJG4KhHq0TN5BeSIbWxHa51CQ97Mv12/QG46iMTyoY1p44m1RNPz5RXgi9Uz8lPZFvSDP7/+AwvWxyewCk1aeZD2P0NRkyfCB9UqAZAI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784211831; c=relaxed/simple; bh=jekBuyoi3t1yAt/+xQmSJmxK3gDWBVQ8Df8CwhsyODo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=H5qMSfSlCXZwz8Me8HvQqXGTUhjLjppPpKgEsjcDps2box7CpWOAx6iteKtpnQTFxNEhS6A08WFXgH6wQWeNVZUbwsYZs5vb+tXmqfTY+RulsBeG1WBaYGEHB8OYFwG5z54o43CGbxtE1UsWc9VDTVS86H3WbH4UUn8UIwhbons= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.b=dt4gmooh; 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="dt4gmooh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id EB47D1F000E9; Thu, 16 Jul 2026 14:23:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1784211829; bh=XMnDTzJaP4wlEwUD1mguWVb6iqZx1XlH1tOyT0EEmDA=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dt4gmoohMQXB1m121GUGojTfCLTl8q0DeQDYxCkIO/T00yD9NU8SkfNURPIZ7tfQV 1zuruNvTbSrmHu0xLlHRP6BbwHfxLBc0jlVX0i+NPjghsl97flGSNPIVk6vIHdzBe6 wcWbTNyNXuQYHgByalmLaKwm+BuLZwLIO76iub4s= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, Paul Menzel , Johan Hovold , Luiz Augusto von Dentz Subject: [PATCH 6.12 094/349] Bluetooth: btusb: fix use-after-free on registration failure Date: Thu, 16 Jul 2026 15:30:28 +0200 Message-ID: <20260716133035.415825872@linuxfoundation.org> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20260716133033.287196923@linuxfoundation.org> References: <20260716133033.287196923@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.12-stable review patch. If anyone has any objections, please let me know. ------------------ From: Johan Hovold commit eedc6867ebad73edbfaf9a0a65fbef7115cc4753 upstream. Make sure to release the sibling interfaces in case controller registration fails to avoid use-after-free and double-free when they are eventually disconnected. This issue was reported by Sashiko while reviewing a fix for a wakeup source leak in the btusb probe errors paths. Link: https://sashiko.dev/#/patchset/20260402092704.2346710-1-johan%40kernel.org Fixes: 9bfa35fe422c ("[Bluetooth] Add SCO support to btusb driver") Fixes: 9d08f50401ac ("Bluetooth: btusb: Add support for Broadcom LM_DIAG interface") Cc: stable@vger.kernel.org # 2.6.27 Reviewed-by: Paul Menzel Signed-off-by: Johan Hovold Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/btusb.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) --- a/drivers/bluetooth/btusb.c +++ b/drivers/bluetooth/btusb.c @@ -4196,7 +4196,7 @@ static int btusb_probe(struct usb_interf err = hci_register_dev(hdev); if (err < 0) - goto out_free_dev; + goto err_release_siblings; usb_set_intfdata(intf, data); @@ -4205,6 +4205,15 @@ static int btusb_probe(struct usb_interf return 0; +err_release_siblings: + if (data->diag) { + usb_set_intfdata(data->diag, NULL); + usb_driver_release_interface(&btusb_driver, data->diag); + } + if (data->isoc) { + usb_set_intfdata(data->isoc, NULL); + usb_driver_release_interface(&btusb_driver, data->isoc); + } out_free_dev: if (data->reset_gpio) gpiod_put(data->reset_gpio);