* [PATCH] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files
@ 2026-11-05 5:56 YuanZhe Liu
2026-11-05 9:16 ` bluez.test.bot
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: YuanZhe Liu @ 2026-11-05 5:56 UTC (permalink / raw)
To: Bartosz Golaszewski, Marcel Holtmann, Luiz Augusto von Dentz
Cc: linux-arm-msm, linux-bluetooth, linux-kernel, stable,
Ben Young Tae Kim
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>
---
drivers/bluetooth/hci_qca.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/drivers/bluetooth/hci_qca.c b/drivers/bluetooth/hci_qca.c
index 7089e9b639b2..d96ae0fc2b2e 100644
--- 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_info *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;
@@ -665,6 +666,7 @@ static void qca_debugfs_init(struct hci_dev *hdev)
return;
ibs_dir = debugfs_create_dir("ibs", hdev->debugfs);
+ qca->debugfs_ibs_dir = ibs_dir;
/* read only */
mode = 0444;
@@ -744,6 +746,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;
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* RE: Bluetooth: hci_qca: fix use-after-free in ibs debugfs files
2026-11-05 5:56 [PATCH] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files YuanZhe Liu
@ 2026-11-05 9:16 ` bluez.test.bot
2026-11-05 9:20 ` [PATCH] " Bartosz Golaszewski
2026-11-05 16:32 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-11-05 9:16 UTC (permalink / raw)
To: linux-bluetooth, 25031212351
[-- Attachment #1: Type: text/plain, Size: 1020 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/series/1202755/
---Test result---
Test Summary:
CheckPatch PASS 0.54 seconds
VerifyFixes PASS 0.10 seconds
VerifySignedoff PASS 5.49 seconds
GitLint PASS 9.75 seconds
SubjectPrefix PASS 0.50 seconds
BuildKernel PASS 23.24 seconds
CheckAllWarning PASS 22.03 seconds
CheckSparse PASS 24.64 seconds
BuildKernel32 PASS 20.28 seconds
CheckKernelLLVM PASS 21.23 seconds
TestRunnerSetup PASS 454.56 seconds
IncrementalBuild PASS 44.95 seconds
https://github.com/bluez/bluetooth-next/pull/1070
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files
2026-11-05 5:56 [PATCH] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files YuanZhe Liu
2026-11-05 9:16 ` bluez.test.bot
@ 2026-11-05 9:20 ` Bartosz Golaszewski
2026-11-05 16:32 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: Bartosz Golaszewski @ 2026-11-05 9:20 UTC (permalink / raw)
To: YuanZhe Liu
Cc: Marcel Holtmann, Luiz Augusto von Dentz, linux-arm-msm,
linux-bluetooth, linux-kernel, stable, Ben Young Tae Kim
On Thu, Nov 05, 2026 at 01:56:45PM +0800, YuanZhe Liu wrote:
> 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 <bartosz.golaszewski@oss.qualcomm.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files
2026-11-05 5:56 [PATCH] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files YuanZhe Liu
2026-11-05 9:16 ` bluez.test.bot
2026-11-05 9:20 ` [PATCH] " Bartosz Golaszewski
@ 2026-11-05 16:32 ` patchwork-bot+bluetooth
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+bluetooth @ 2026-11-05 16:32 UTC (permalink / raw)
To: YuanZhe Liu
Cc: brgl, marcel, luiz.dentz, linux-arm-msm, linux-bluetooth,
linux-kernel, stable, ytkim
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Thu, 5 Nov 2026 13:56:45 +0800 you wrote:
> 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.
>
> [...]
Here is the summary with links:
- Bluetooth: hci_qca: fix use-after-free in ibs debugfs files
https://git.kernel.org/bluetooth/bluetooth-next/c/eeca795cec6d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-11-05 16:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-05 5:56 [PATCH] Bluetooth: hci_qca: fix use-after-free in ibs debugfs files YuanZhe Liu
2026-11-05 9:16 ` bluez.test.bot
2026-11-05 9:20 ` [PATCH] " Bartosz Golaszewski
2026-11-05 16:32 ` patchwork-bot+bluetooth
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox