--- x/net/bluetooth/hci_sync.c +++ y/net/bluetooth/hci_sync.c @@ -862,14 +862,17 @@ bool hci_cmd_sync_dequeue_once(struct hc void *data, hci_cmd_sync_work_destroy_t destroy) { struct hci_cmd_sync_work_entry *entry; + bool ret = false; - entry = hci_cmd_sync_lookup_entry(hdev, func, data, destroy); - if (!entry) - return false; + mutex_lock(&hdev->cmd_sync_work_lock); + entry = _hci_cmd_sync_lookup_entry(hdev, func, data, destroy); + if (entry) { + _hci_cmd_sync_cancel_entry(hdev, entry, -ECANCELED); + ret = true; + } + mutex_unlock(&hdev->cmd_sync_work_lock); - hci_cmd_sync_cancel_entry(hdev, entry); - - return true; + return ret; } EXPORT_SYMBOL(hci_cmd_sync_dequeue_once);