aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorBenjamin Berg <bberg@redhat.com>2021-12-03 15:58:59 +0100
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2021-12-03 10:41:59 -0800
commitae422391e17d30a2fb1d0968142dcd1e4cdc172a (patch)
tree5f19ae66b4ba2da658d22710ca5b0edf8588dc91 /net/bluetooth
parentBluetooth: Limit duration of Remote Name Resolve (diff)
downloadlinux-dev-ae422391e17d30a2fb1d0968142dcd1e4cdc172a.tar.xz
linux-dev-ae422391e17d30a2fb1d0968142dcd1e4cdc172a.zip
Bluetooth: Reset more state when cancelling a sync command
Resetting the timers and cmd_cnt means that we assume the device will be in a good state after the sync command finishes. Without this a chain of synchronous commands might get stuck if one of them is cancelled. Signed-off-by: Benjamin Berg <bberg@redhat.com> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_request.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bluetooth/hci_request.c b/net/bluetooth/hci_request.c
index 8b3205e4b23e..58d640a31bde 100644
--- a/net/bluetooth/hci_request.c
+++ b/net/bluetooth/hci_request.c
@@ -118,6 +118,11 @@ void hci_req_sync_cancel(struct hci_dev *hdev, int err)
if (hdev->req_status == HCI_REQ_PEND) {
hdev->req_result = err;
hdev->req_status = HCI_REQ_CANCELED;
+
+ cancel_delayed_work_sync(&hdev->cmd_timer);
+ cancel_delayed_work_sync(&hdev->ncmd_timer);
+ atomic_set(&hdev->cmd_cnt, 1);
+
wake_up_interruptible(&hdev->req_wait_q);
}
}