Message ID | 20241125175111.8598-1-quic_jiaymao@quicinc.com |
---|---|
State | New |
Headers | show |
Series | [v1] Bluetooth: hci_sync: clear cmd_sync_work_list when power off | expand |
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=912307 ---Test result--- Test Summary: CheckPatch PENDING 0.21 seconds GitLint PENDING 0.20 seconds SubjectPrefix PASS 0.12 seconds BuildKernel PASS 24.92 seconds CheckAllWarning PASS 27.10 seconds CheckSparse PASS 30.41 seconds BuildKernel32 PASS 24.32 seconds TestRunnerSetup PASS 435.36 seconds TestRunner_l2cap-tester PASS 23.17 seconds TestRunner_iso-tester FAIL 30.76 seconds TestRunner_bnep-tester PASS 4.89 seconds TestRunner_mgmt-tester PASS 120.54 seconds TestRunner_rfcomm-tester PASS 7.64 seconds TestRunner_sco-tester PASS 15.60 seconds TestRunner_ioctl-tester PASS 8.23 seconds TestRunner_mesh-tester PASS 6.14 seconds TestRunner_smp-tester PASS 7.08 seconds TestRunner_userchan-tester PASS 5.32 seconds IncrementalBuild PENDING 0.41 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: WARNING: possible circular locking dependency detected Total: 124, Passed: 120 (96.8%), Failed: 0, Not Run: 4 ############################## Test: IncrementalBuild - PENDING Desc: Incremental build with the patches in the series Output: --- Regards, Linux Bluetooth
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c index c86f4e42e..bc622d074 100644 --- a/net/bluetooth/hci_sync.c +++ b/net/bluetooth/hci_sync.c @@ -5139,6 +5139,7 @@ int hci_dev_close_sync(struct hci_dev *hdev) { bool auto_off; int err = 0; + struct hci_cmd_sync_work_entry *entry, *tmp; bt_dev_dbg(hdev, ""); @@ -5258,6 +5259,11 @@ int hci_dev_close_sync(struct hci_dev *hdev) clear_bit(HCI_RUNNING, &hdev->flags); hci_sock_dev_event(hdev, HCI_DEV_CLOSE); + mutex_lock(&hdev->cmd_sync_work_lock); + list_for_each_entry_safe(entry, tmp, &hdev->cmd_sync_work_list, list) + _hci_cmd_sync_cancel_entry(hdev, entry, -ECANCELED); + mutex_unlock(&hdev->cmd_sync_work_lock); + /* After this point our queues are empty and no tasks are scheduled. */ hdev->close(hdev);
Clear the remaining command in cmd_sync_work_list when BT is performing power off. In some cases, this list is not empty after power off. BT host will try to send more HCI commands. This can cause unexpected results. Signed-off-by: Jiayang Mao <quic_jiaymao@quicinc.com> --- net/bluetooth/hci_sync.c | 6 ++++++ 1 file changed, 6 insertions(+)