Created
February 28, 2023 21:01
-
-
Save Vudentz/365d664275e4d2e2af157e47f0502f50 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c | |
index 561a519a11bd..c1f0ef47cbf5 100644 | |
--- a/net/bluetooth/hci_sync.c | |
+++ b/net/bluetooth/hci_sync.c | |
@@ -636,13 +636,11 @@ void hci_cmd_sync_init(struct hci_dev *hdev) | |
INIT_DELAYED_WORK(&hdev->adv_instance_expire, adv_timeout_expire); | |
} | |
-void hci_cmd_sync_clear(struct hci_dev *hdev) | |
+static void hci_cmd_sync_work_list_clear(struct hci_dev *hdev) | |
{ | |
struct hci_cmd_sync_work_entry *entry, *tmp; | |
- cancel_work_sync(&hdev->cmd_sync_work); | |
- cancel_work_sync(&hdev->reenable_adv_work); | |
- | |
+ mutex_lock(&hdev->cmd_sync_work_lock); | |
list_for_each_entry_safe(entry, tmp, &hdev->cmd_sync_work_list, list) { | |
if (entry->destroy) | |
entry->destroy(hdev, entry->data, -ECANCELED); | |
@@ -650,6 +648,15 @@ void hci_cmd_sync_clear(struct hci_dev *hdev) | |
list_del(&entry->list); | |
kfree(entry); | |
} | |
+ mutex_unlock(&hdev->cmd_sync_work_lock); | |
+} | |
+ | |
+void hci_cmd_sync_clear(struct hci_dev *hdev) | |
+{ | |
+ cancel_work_sync(&hdev->cmd_sync_work); | |
+ cancel_work_sync(&hdev->reenable_adv_work); | |
+ | |
+ hci_cmd_sync_work_list_clear(hdev); | |
} | |
void __hci_cmd_sync_cancel(struct hci_dev *hdev, int err) | |
@@ -4829,8 +4836,10 @@ int hci_dev_close_sync(struct hci_dev *hdev) | |
cancel_delayed_work(&hdev->ncmd_timer); | |
cancel_delayed_work(&hdev->le_scan_disable); | |
cancel_delayed_work(&hdev->le_scan_restart); | |
+ cancel_interleave_scan(hdev); | |
- hci_request_cancel_all(hdev); | |
+ /* Cancel ongoing request */ | |
+ __hci_cmd_sync_cancel(hdev, ENODEV); | |
if (hdev->adv_instance_timeout) { | |
cancel_delayed_work_sync(&hdev->adv_instance_expire); | |
@@ -4844,6 +4853,7 @@ int hci_dev_close_sync(struct hci_dev *hdev) | |
return err; | |
} | |
+ hci_cmd_sync_work_list_clear(hdev); | |
hci_leds_update_powered(hdev, false); | |
/* Flush RX and TX works */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment