]> Git Repo - linux.git/commitdiff
Bluetooth: core: Fix missing power_on work cancel on HCI close
authorVasyl Vavrychuk <[email protected]>
Tue, 26 Apr 2022 08:18:23 +0000 (11:18 +0300)
committerMarcel Holtmann <[email protected]>
Fri, 13 May 2022 11:05:49 +0000 (13:05 +0200)
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 <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
net/bluetooth/hci_core.c
net/bluetooth/hci_sync.c

index 45c2dd2e15905fef2695391ec80414c1be5bbf90..5abb2ca5b129995dfc8bcf6e804a0b4fbb87ca15 100644 (file)
@@ -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))
index b06e01bef66e6f70fa6af03d092e1cea6db8db62..a6ada9dcede55e7a021b8fcb422edaca8b07bb75 100644 (file)
@@ -4089,6 +4089,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);
 
This page took 0.065303 seconds and 4 git commands to generate.