diff mbox series

Bluetooth: core: Fix missing power_on work cancel on HCI close

Message ID 20220426081823.21557-1-vasyl.vavrychuk@opensynergy.com (mailing list archive)
State Accepted
Commit 2d866d8ec36f2c4aa16425d7d28b341d3e3b4e24
Headers show
Series Bluetooth: core: Fix missing power_on work cancel on HCI close | expand

Checks

Context Check Description
tedd_an/pre-ci_am success Success
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/subjectprefix success PASS
tedd_an/buildkernel success Build Kernel PASS
tedd_an/buildkernel32 success Build Kernel32 PASS
tedd_an/incremental_build success Pass
tedd_an/testrunnersetup success Test Runner Setup PASS
tedd_an/testrunnerl2cap-tester success Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerbnep-tester success Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnermgmt-tester success Total: 493, Passed: 493 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerrfcomm-tester success Total: 10, Passed: 10 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersco-tester success Total: 12, Passed: 12 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersmp-tester success Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunneruserchan-tester success Total: 4, Passed: 4 (100.0%), Failed: 0, Not Run: 0

Commit Message

Vasyl Vavrychuk April 26, 2022, 8:18 a.m. UTC
Move power_on work cancel to hci_dev_close_sync to ensure that power_on
work is canceled after HCI interface down, power off, rfkill, etc.

For example, if

    hciconfig hci0 down

is done early enough during boot, it may run before power_on work.
Then, power_on work will actually bring up interface despite above
hciconfig command.

Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@opensynergy.com>
---
 net/bluetooth/hci_core.c | 2 --
 net/bluetooth/hci_sync.c | 1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

Comments

bluez.test.bot@gmail.com April 26, 2022, 9:15 a.m. UTC | #1
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=635639

---Test result---

Test Summary:
CheckPatch                    PASS      1.82 seconds
GitLint                       PASS      0.95 seconds
SubjectPrefix                 PASS      0.92 seconds
BuildKernel                   PASS      31.45 seconds
BuildKernel32                 PASS      28.44 seconds
Incremental Build with patchesPASS      38.02 seconds
TestRunner: Setup             PASS      470.78 seconds
TestRunner: l2cap-tester      PASS      17.35 seconds
TestRunner: bnep-tester       PASS      6.08 seconds
TestRunner: mgmt-tester       PASS      102.04 seconds
TestRunner: rfcomm-tester     PASS      9.61 seconds
TestRunner: sco-tester        PASS      9.48 seconds
TestRunner: smp-tester        PASS      9.50 seconds
TestRunner: userchan-tester   PASS      6.38 seconds



---
Regards,
Linux Bluetooth
patchwork-bot+bluetooth@kernel.org April 26, 2022, 6:20 p.m. UTC | #2
Hello:

This patch was applied to bluetooth/bluetooth-next.git (master)
by Marcel Holtmann <marcel@holtmann.org>:

On Tue, 26 Apr 2022 11:18:23 +0300 you wrote:
> Move power_on work cancel to hci_dev_close_sync to ensure that power_on
> work is canceled after HCI interface down, power off, rfkill, etc.
> 
> For example, if
> 
>     hciconfig hci0 down
> 
> [...]

Here is the summary with links:
  - Bluetooth: core: Fix missing power_on work cancel on HCI close
    https://git.kernel.org/bluetooth/bluetooth-next/c/2d866d8ec36f

You are awesome, thank you!
diff mbox series

Patch

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index b4782a6c1025..ad4f4ab0afca 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2675,8 +2675,6 @@  void hci_unregister_dev(struct hci_dev *hdev)
 	list_del(&hdev->list);
 	write_unlock(&hci_dev_list_lock);
 
-	cancel_work_sync(&hdev->power_on);
-
 	hci_cmd_sync_clear(hdev);
 
 	if (!test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks))
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index 8f4c5698913d..c5b0dbfc0379 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -4058,6 +4058,7 @@  int hci_dev_close_sync(struct hci_dev *hdev)
 
 	bt_dev_dbg(hdev, "");
 
+	cancel_work_sync(&hdev->power_on);
 	cancel_delayed_work(&hdev->power_off);
 	cancel_delayed_work(&hdev->ncmd_timer);