From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796388168; b=3ssqbHmT9mr/LQx+VAOkh31cMxao6C7BAW/EE710bX4T9DD6uKXclqfLmr+rz4x6Z4Xr FDZeXRMdqH97mf9ymgam3SMrLfUy8vUaCZm3hykHpEahFzrx1F/4EP3QhACEnYC1qJlEd V/UByLN0+Wma8vV7EVGO9FcxI/RH7WPBNA/n0jWWqdmyX0zEguVEp8fiyQI9Lq8I9nxbs 63R4P0yiQj3X/y1NQkQ+GKhNllWS2Y40/ZqwImerTTSGpWYOKTzvxCJtgWEIyikPD3E+b tjiOBOvcv02dxkHxSZ/eLobgUyLL+8JzvHrr4c1CcnD/t2bBRV5jVgFLGNAEJpQuF+Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796388168; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:User-Agent:X-stable:X-Patchwork-Hint: MIME-Version:Content-Transfer-Encoding; bh=6TyZLrPQQP9Xi5EPoJdNyOq8Q95YYFlNYMV69kFht8M=; b=0ILvyniONOGGARhcQAKEeD6VScPVDAd49tM05nnV1lUDKnHTXDN1dfUc3JeFfcIWr2vI AN43D1ieXHLclGXRnRdvjSpEkPXdkxr5irNhukMq1Ky3DMtKbOFLNgrjNH3SFDIN32xaU edhEflNzbztoDRDSQcq+Aeg2omOgrOmBNlxba2OaQgqOpyLYmvsJV0EuC317BUgzUmfTD TS9Nf6HzM0DEvjdli90gnhCx5VWAEy7UocJtbeekiNAAshiLisuR+tUz422l+sghTIgdQ C2mVGC0rI4k255R8UN8zCW0EjTRxOwl1dBUOGY0DFjcEQnKeB3nXRXzHc9reZhjLoZg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dEVeHDYF; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9A7D4606A32C; Fri, 4 Dec 2026 12:42:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linuxfoundation.org header.i=@linuxfoundation.org header.a=rsa-sha256 header.s=korg header.b=dEVeHDYF Received: by smtp.kernel.org (Postfix) with ESMTPSA id 10F051F000C2; Fri, 4 Dec 2026 12:42:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=korg; t=1796388168; bh=6TyZLrPQQP9Xi5EPoJdNyOq8Q95YYFlNYMV69kFht8M=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=dEVeHDYFEV7/6HszCHGFWGPLUExaCMPZstNbuMJLWyeqpdXDWvtC/qcwQ0OchOnpP MSvyomAuqbl1aZkwWSqvQo68QHkHF3dQlIhMQ/8V1wg/NToPn7p7XQJdmJG+i0NHvA 88V2l+7BK/Pll2q3VhxnLqv25ptZocfPKgPzFFCk= From: Greg Kroah-Hartman To: stable@vger.kernel.org Cc: Greg Kroah-Hartman , patches@lists.linux.dev, YuanZhe Liu <25031212351@stu.xidian.edu.cn>, Bartosz Golaszewski , Luiz Augusto von Dentz Subject: [PATCH 6.1 0511/1059] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files Date: Fri, 4 Dec 2026 19:00:42 +0900 Message-ID: <20261204100657.483377065@linuxfoundation.org> X-Mailer: git-send-email 2.56.1 In-Reply-To: <20261204100643.980430235@linuxfoundation.org> References: <20261204100643.980430235@linuxfoundation.org> User-Agent: quilt/0.69 X-stable: review X-Patchwork-Hint: ignore X-Mailing-List: stable@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: YuanZhe Liu <25031212351@stu.xidian.edu.cn> commit eeca795cec6d9c6c193c2c1bd0cb26cde44f9fc3 upstream. qca_debugfs_init() creates an "ibs" directory under hdev->debugfs and stores pointers to fields of struct qca_data in the debugfs files. qca_close() frees qca_data without removing that directory, while hdev->debugfs is only removed when the HCI device is released. The HCI device can outlive the driver data, for example when an HCI socket still references it, so reading or writing one of the ibs files then dereferences freed memory. Store the directory dentry in struct qca_data and remove the directory with debugfs_remove_recursive() before qca_data is freed. debugfs_remove() waits for callers that are already inside the file operations, and any later access fails with -EIO instead of reaching the debugfs helpers. This covers the two writable files as well. Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261102113654.8724-1-25031212351%40stu.xidian.edu.cn Fixes: 0ff252c1976d ("Bluetooth: hciuart: Add support QCA chipset for UART") Cc: stable@vger.kernel.org Signed-off-by: YuanZhe Liu <25031212351@stu.xidian.edu.cn> Reviewed-by: Bartosz Golaszewski Signed-off-by: Luiz Augusto von Dentz Signed-off-by: Greg Kroah-Hartman --- drivers/bluetooth/hci_qca.c | 5 +++++ 1 file changed, 5 insertions(+) --- a/drivers/bluetooth/hci_qca.c +++ b/drivers/bluetooth/hci_qca.c @@ -161,6 +161,7 @@ struct qca_data { struct delayed_work ctrl_memdump_timeout; struct qca_memdump_data *qca_memdump; unsigned long flags; + struct dentry *debugfs_ibs_dir; struct completion drop_ev_comp; wait_queue_head_t suspend_wait_q; enum qca_memdump_states memdump_state; @@ -649,6 +650,7 @@ static void qca_debugfs_init(struct hci_ return; ibs_dir = debugfs_create_dir("ibs", hdev->debugfs); + qca->debugfs_ibs_dir = ibs_dir; /* read only */ mode = 0444; @@ -724,6 +726,9 @@ static int qca_close(struct hci_uart *hu hu->priv = NULL; + debugfs_remove_recursive(qca->debugfs_ibs_dir); + qca->debugfs_ibs_dir = NULL; + kfree(qca); return 0;