* [PATCH v1] Bluetooth: hci_release_dev: disable delayed devcoredump work
@ 2026-03-22 21:08 Aby Sam Ross
2026-03-22 21:43 ` [v1] " bluez.test.bot
2026-03-24 20:42 ` [PATCH v1] " Luiz Augusto von Dentz
0 siblings, 2 replies; 4+ messages in thread
From: Aby Sam Ross @ 2026-03-22 21:08 UTC (permalink / raw)
To: marcel, luiz.dentz
Cc: linux-bluetooth, linux-kernel, skhan, me, Aby Sam Ross,
syzbot+b170dbf55520ebf5969a
It is not necessary that the pending delayed hci devcoredump timeout
work, hdev->dump.dump_timeout, submitted to the hdev->workqueue by the
bluetooth devcoredump state machine,
hci_devcd_rx()
hci_devcd_handle_pkt_init()
will be reset by it or by the timeout func hci_devcd_timeout(), using
hci_devcd_reset(), before destroying the workqueue or before the hci
device is freed up in hci_release_dev().
In this bug the active delayed devcoredump timeout work's timer object
is active when the memory associated with the hci device is freed up in
hci_release_dev() causing the ODEBUG WARNING.
Make sure that the delayed devcoredump timeout work is disabled before
the hdev->workqueue is destroyed and before the hdev memory is freed in
hci_release_dev().
Tested the change with the syzbot reproducer that uses vhci device
locally on x86_64 and on syzbot portal as well. Ran kselftest with net
target.
Fixes: 9695ef876fd1 ("Bluetooth: Add support for hci devcoredump")
Reported-by: syzbot+b170dbf55520ebf5969a@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=b170dbf55520ebf5969a
Tested-by: syzbot+b170dbf55520ebf5969a@syzkaller.appspotmail.com
Signed-off-by: Aby Sam Ross <abysamross@gmail.com>
---
net/bluetooth/hci_core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 01f8ceeb1c0c..1c7ee2a33337 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2747,6 +2747,9 @@ void hci_release_dev(struct hci_dev *hdev)
kfree_const(hdev->hw_info);
kfree_const(hdev->fw_info);
+ if (hdev->dump.supported)
+ disable_delayed_work_sync(&hdev->dump.dump_timeout);
+
destroy_workqueue(hdev->workqueue);
destroy_workqueue(hdev->req_workqueue);
--
2.53.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* RE: [v1] Bluetooth: hci_release_dev: disable delayed devcoredump work
2026-03-22 21:08 [PATCH v1] Bluetooth: hci_release_dev: disable delayed devcoredump work Aby Sam Ross
@ 2026-03-22 21:43 ` bluez.test.bot
2026-03-24 20:42 ` [PATCH v1] " Luiz Augusto von Dentz
1 sibling, 0 replies; 4+ messages in thread
From: bluez.test.bot @ 2026-03-22 21:43 UTC (permalink / raw)
To: linux-bluetooth, abysamross
[-- Attachment #1: Type: text/plain, Size: 2833 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/project/bluetooth/list/?series=1070558
---Test result---
Test Summary:
CheckPatch PENDING 0.39 seconds
GitLint PENDING 0.25 seconds
SubjectPrefix PASS 0.12 seconds
BuildKernel PASS 26.40 seconds
CheckAllWarning PASS 28.76 seconds
CheckSparse PASS 30.08 seconds
BuildKernel32 PASS 25.51 seconds
TestRunnerSetup PASS 569.23 seconds
TestRunner_l2cap-tester PASS 28.00 seconds
TestRunner_iso-tester FAIL 32.58 seconds
TestRunner_bnep-tester PASS 6.38 seconds
TestRunner_mgmt-tester FAIL 115.69 seconds
TestRunner_rfcomm-tester PASS 9.48 seconds
TestRunner_sco-tester FAIL 14.16 seconds
TestRunner_ioctl-tester PASS 10.13 seconds
TestRunner_mesh-tester FAIL 12.48 seconds
TestRunner_smp-tester PASS 8.47 seconds
TestRunner_userchan-tester PASS 6.71 seconds
IncrementalBuild PENDING 0.48 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_iso-tester - FAIL
Desc: Run iso-tester with test-runner
Output:
BUG: KASAN: slab-use-after-free in le_read_features_complete+0x7e/0x2b0
Total: 141, Passed: 141 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 494, Passed: 489 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.107 seconds
##############################
Test: TestRunner_sco-tester - FAIL
Desc: Run sco-tester with test-runner
Output:
WARNING: possible circular locking dependency detected
BUG: sleeping function called from invalid context at net/core/sock.c:3782
Total: 30, Passed: 30 (100.0%), Failed: 0, Not Run: 0
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 2.773 seconds
Mesh - Send cancel - 2 Timed out 1.993 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1] Bluetooth: hci_release_dev: disable delayed devcoredump work
2026-03-22 21:08 [PATCH v1] Bluetooth: hci_release_dev: disable delayed devcoredump work Aby Sam Ross
2026-03-22 21:43 ` [v1] " bluez.test.bot
@ 2026-03-24 20:42 ` Luiz Augusto von Dentz
2026-03-28 10:19 ` Aby Sam Ross
1 sibling, 1 reply; 4+ messages in thread
From: Luiz Augusto von Dentz @ 2026-03-24 20:42 UTC (permalink / raw)
To: Aby Sam Ross
Cc: marcel, linux-bluetooth, linux-kernel, skhan, me,
syzbot+b170dbf55520ebf5969a
Hi Aby,
On Sun, Mar 22, 2026 at 5:09 PM Aby Sam Ross <abysamross@gmail.com> wrote:
>
> It is not necessary that the pending delayed hci devcoredump timeout
> work, hdev->dump.dump_timeout, submitted to the hdev->workqueue by the
> bluetooth devcoredump state machine,
> hci_devcd_rx()
> hci_devcd_handle_pkt_init()
> will be reset by it or by the timeout func hci_devcd_timeout(), using
> hci_devcd_reset(), before destroying the workqueue or before the hci
> device is freed up in hci_release_dev().
>
> In this bug the active delayed devcoredump timeout work's timer object
> is active when the memory associated with the hci device is freed up in
> hci_release_dev() causing the ODEBUG WARNING.
>
> Make sure that the delayed devcoredump timeout work is disabled before
> the hdev->workqueue is destroyed and before the hdev memory is freed in
> hci_release_dev().
>
> Tested the change with the syzbot reproducer that uses vhci device
> locally on x86_64 and on syzbot portal as well. Ran kselftest with net
> target.
>
> Fixes: 9695ef876fd1 ("Bluetooth: Add support for hci devcoredump")
> Reported-by: syzbot+b170dbf55520ebf5969a@syzkaller.appspotmail.com
> Closes: https://syzkaller.appspot.com/bug?extid=b170dbf55520ebf5969a
> Tested-by: syzbot+b170dbf55520ebf5969a@syzkaller.appspotmail.com
> Signed-off-by: Aby Sam Ross <abysamross@gmail.com>
> ---
> net/bluetooth/hci_core.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> index 01f8ceeb1c0c..1c7ee2a33337 100644
> --- a/net/bluetooth/hci_core.c
> +++ b/net/bluetooth/hci_core.c
> @@ -2747,6 +2747,9 @@ void hci_release_dev(struct hci_dev *hdev)
> kfree_const(hdev->hw_info);
> kfree_const(hdev->fw_info);
>
> + if (hdev->dump.supported)
> + disable_delayed_work_sync(&hdev->dump.dump_timeout);
> +
> destroy_workqueue(hdev->workqueue);
> destroy_workqueue(hdev->req_workqueue);
>
> --
> 2.53.0
>
https://sashiko.dev/#/patchset/20260322210849.68743-1-abysamross%40gmail.com
Both points seems valid, that perhaps the dump shouldn't be attached
to hdev object since it maybe necessary to unregister the hdev as part
of devcoredump handling, anyway if it is required then upon unregister
it shall actually cleanup the dump object as well.
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH v1] Bluetooth: hci_release_dev: disable delayed devcoredump work
2026-03-24 20:42 ` [PATCH v1] " Luiz Augusto von Dentz
@ 2026-03-28 10:19 ` Aby Sam Ross
0 siblings, 0 replies; 4+ messages in thread
From: Aby Sam Ross @ 2026-03-28 10:19 UTC (permalink / raw)
To: Luiz Augusto von Dentz
Cc: marcel, linux-bluetooth, linux-kernel, skhan, me,
syzbot+b170dbf55520ebf5969a
On Tue, Mar 24, 2026 at 04:42:21PM -0400, Luiz Augusto von Dentz wrote:
> Hi Aby,
>
> On Sun, Mar 22, 2026 at 5:09 PM Aby Sam Ross <abysamross@gmail.com> wrote:
> >
> > It is not necessary that the pending delayed hci devcoredump timeout
> > work, hdev->dump.dump_timeout, submitted to the hdev->workqueue by the
> > bluetooth devcoredump state machine,
> > hci_devcd_rx()
> > hci_devcd_handle_pkt_init()
> > will be reset by it or by the timeout func hci_devcd_timeout(), using
> > hci_devcd_reset(), before destroying the workqueue or before the hci
> > device is freed up in hci_release_dev().
> >
> > In this bug the active delayed devcoredump timeout work's timer object
> > is active when the memory associated with the hci device is freed up in
> > hci_release_dev() causing the ODEBUG WARNING.
> >
> > Make sure that the delayed devcoredump timeout work is disabled before
> > the hdev->workqueue is destroyed and before the hdev memory is freed in
> > hci_release_dev().
> >
> > Tested the change with the syzbot reproducer that uses vhci device
> > locally on x86_64 and on syzbot portal as well. Ran kselftest with net
> > target.
> >
> > Fixes: 9695ef876fd1 ("Bluetooth: Add support for hci devcoredump")
> > Reported-by: syzbot+b170dbf55520ebf5969a@syzkaller.appspotmail.com
> > Closes: https://syzkaller.appspot.com/bug?extid=b170dbf55520ebf5969a
> > Tested-by: syzbot+b170dbf55520ebf5969a@syzkaller.appspotmail.com
> > Signed-off-by: Aby Sam Ross <abysamross@gmail.com>
> > ---
> > net/bluetooth/hci_core.c | 3 +++
> > 1 file changed, 3 insertions(+)
> >
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index 01f8ceeb1c0c..1c7ee2a33337 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -2747,6 +2747,9 @@ void hci_release_dev(struct hci_dev *hdev)
> > kfree_const(hdev->hw_info);
> > kfree_const(hdev->fw_info);
> >
> > + if (hdev->dump.supported)
> > + disable_delayed_work_sync(&hdev->dump.dump_timeout);
> > +
> > destroy_workqueue(hdev->workqueue);
> > destroy_workqueue(hdev->req_workqueue);
> >
> > --
> > 2.53.0
> >
>
> https://sashiko.dev/#/patchset/20260322210849.68743-1-abysamross%40gmail.com
>
> Both points seems valid, that perhaps the dump shouldn't be attached
> to hdev object since it maybe necessary to unregister the hdev as part
> of devcoredump handling, anyway if it is required then upon unregister
> it shall actually cleanup the dump object as well.
>
> --
> Luiz Augusto von Dentz
Hi Luiz,
From what I see hci_unregister_dev() is called by all bluetooth drivers that use
hci_devcd_init(). Please correct me if I am wrong.
So we can either make hci_devcd_free() non-static and then call it from
hci_unregister_dev()
OR
Do vfree(hdev->dump.head) followed by disabling the delayed devcoredump timeout
work in hci_unregister_dev()
And then destroy the workqueue(dump_rx)?
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2026-03-28 10:19 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-22 21:08 [PATCH v1] Bluetooth: hci_release_dev: disable delayed devcoredump work Aby Sam Ross
2026-03-22 21:43 ` [v1] " bluez.test.bot
2026-03-24 20:42 ` [PATCH v1] " Luiz Augusto von Dentz
2026-03-28 10:19 ` Aby Sam Ross
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox