]> asedeno.scripts.mit.edu Git - linux.git/blobdiff - net/bluetooth/hci_core.c
Bluetooth: fix power_on vs close race
[linux.git] / net / bluetooth / hci_core.c
index 2713fc86e85abd780d9bccfb2bb11cb353d4fcb9..45a9fc68c6774300235ed82600aba6a032d1e15c 100644 (file)
@@ -3139,10 +3139,10 @@ void hci_unregister_dev(struct hci_dev *hdev)
        list_del(&hdev->list);
        write_unlock(&hci_dev_list_lock);
 
-       hci_dev_do_close(hdev);
-
        cancel_work_sync(&hdev->power_on);
 
+       hci_dev_do_close(hdev);
+
        if (!test_bit(HCI_INIT, &hdev->flags) &&
            !hci_dev_test_flag(hdev, HCI_SETUP) &&
            !hci_dev_test_flag(hdev, HCI_CONFIG)) {