Bluetooth: hci_sync: add lock to protect HCI_UNREGISTER
[platform/kernel/linux-starfive.git] / net / bluetooth / hci_core.c
index 0164b56..48917c6 100644 (file)
@@ -2686,7 +2686,9 @@ void hci_unregister_dev(struct hci_dev *hdev)
 {
        BT_DBG("%p name %s bus %d", hdev, hdev->name, hdev->bus);
 
+       mutex_lock(&hdev->unregister_lock);
        hci_dev_set_flag(hdev, HCI_UNREGISTER);
+       mutex_unlock(&hdev->unregister_lock);
 
        write_lock(&hci_dev_list_lock);
        list_del(&hdev->list);