Bluetooth: coredump: Quiesce dump work on unregister
Subsystems (4)
PATCH v3 1/1 Bluetooth: coredump: Quiesce dump work on unregister
hci_devcd_handle_pkt_init() arms dump_timeout and coredump producers queue dump_rx without holding an hdev reference. Unregister leaves both works live, so disconnecting during an active dump lets them access hdev after hci_release_dev() frees it.
Shut down coredump processing during unregister. Close the producer gate under dump_q.lock before disabling both works, then free the active buffer and queued packets under hci_dev_lock. Serializing the gate with enqueue prevents controller-specific workers from adding packets after the final purge.
---
Changes in v3:
- Serialize coredump enqueue with the terminal shutdown gate.
- Reject and free packets submitted after shutdown begins.
- Disable dump_rx and dump_timeout, then free the buffered dump state.
- Add links and credits for the two earlier attempts.
include/net/bluetooth/coredump.h | 2 + net/bluetooth/coredump.c | 65 +++++++++++++++++++++----------- net/bluetooth/hci_core.c | 1 + 3 files changed, 47 insertions(+), 21 deletions(-)
include/net/bluetooth/coredump.h +2 -0
@@ -70,6 +70,7 @@ struct hci_devcoredump {const char *hci_devcd_state_name (enum devcoredump_state state);void hci_devcd_reset (struct hci_dev *hdev); +void hci_devcd_shutdown (struct hci_dev *hdev);void hci_devcd_rx (struct work_struct *work);void hci_devcd_timeout (struct work_struct *work);
@@ -89,6 +90,7 @@ static inline const char *hci_devcd_state_name(enum devcoredump_state state) }static inline void hci_devcd_reset (struct hci_dev *hdev) {} +static inline void hci_devcd_shutdown (struct hci_dev *hdev) {}static inline void hci_devcd_rx (struct work_struct *work) {}static inline void hci_devcd_timeout (struct work_struct *work) {}
net/bluetooth/coredump.c +44 -21
107 lines not on this page · raw message
net/bluetooth/hci_core.c +1 -0
@@ -2673,6 +2673,7 @@ void hci_unregister_dev(struct hci_dev *hdev)disable_work_sync (&hdev->error_reset);disable_delayed_work_sync (&hdev->cmd_timer);disable_delayed_work_sync (&hdev->ncmd_timer); +hci_devcd_shutdown (hdev);hci_cmd_sync_clear (hdev);
base-commit: 2deb76c21b81e42b3282224f7dd2046fe73fd1e0
Signature · 1 line
2.55.0
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=1159097
---Test result---
Test Summary:
CheckPatch FAIL 1.23 seconds VerifyFixes PASS 0.13 seconds VerifySignedoff PASS 0.14 seconds GitLint PASS 0.33 seconds SubjectPrefix PASS 0.13 seconds BuildKernel PASS 28.18 seconds CheckAllWarning PASS 30.72 seconds CheckSparse PASS 29.40 seconds BuildKernel32 PASS 26.96 seconds CheckKernelLLVM SKIP 0.00 seconds TestRunnerSetup PASS 506.11 seconds TestRunner_l2cap-tester PASS 65.94 seconds TestRunner_iso-tester PASS 105.72 seconds TestRunner_bnep-tester PASS 19.19 seconds TestRunner_mgmt-tester FAIL 223.27 seconds TestRunner_rfcomm-tester PASS 25.81 seconds TestRunner_sco-tester PASS 32.26 seconds TestRunner_ioctl-tester PASS 26.88 seconds TestRunner_mesh-tester FAIL 25.95 seconds TestRunner_smp-tester PASS 23.57 seconds TestRunner_userchan-tester PASS 19.89 seconds TestRunner_6lowpan-tester PASS 23.18 seconds IncrementalBuild PASS 26.22 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v3] Bluetooth: coredump: Quiesce dump work on unregister
WARNING: Reported-by: should be immediately followed by Closes: or Link: with a URL to the report #130:
WARNING: Assisted-by expects 'AGENT_NAME:MODEL_VERSION [TOOL1] [TOOL2]' format #131:
total: 0 errors, 2 warnings, 0 checks, 128 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/github/workspace/src/patch/14794291.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis Output:
Clang not found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 501, Passed: 496 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.249 seconds
##############################
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.249 seconds Mesh - Send cancel - 2 Timed out 1.986 seconds
https://github.com/bluez/bluetooth-next/pull/712
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 5 lines · On Sun, 6 Sep 2026 23:43:32 +0800 you wrote:
hci_devcd_handle_pkt_init()armsdump_timeoutand coredump producers queuedump_rxwithout holding an hdev reference. Unregister leaves both works live, so disconnecting during an active dump lets them access hdev afterhci_release_dev()frees it.
Quoted 7 lines
Shut down coredump processing during unregister. Close the producer gate under dump_q.lock before disabling both works, then free the active buffer and queued packets under
hci_dev_lock. Serializing the gate with enqueue prevents controller-specific workers from adding packets after the final purge.[...]
Here is the summary with links:
- [v3] Bluetooth: coredump: Quiesce dump work on unregister
https://git.kernel.org/bluetooth/bluetooth-next/c/701ca71884b3
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html