diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2014-02-28 13:26:12 -0500 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2014-02-28 13:28:16 -0500 |
commit | 317ac8cb3f9fb58b9ec5764b766a449004ab2a62 (patch) | |
tree | f94c7db069a87514a4b5e16cff1dafbbd5981dd7 /net/bluetooth/hci_event.c | |
parent | e3098be40bbde0fdd5fcfa6bf28491db421d333a (diff) |
Bluetooth: Fix trying to disable scanning twice
The discovery process has a timer for disabling scanning, however
scanning might be disabled through other means too like the auto-connect
process. We should therefore ensure that the timer is never active
after sending a HCI command to disable scanning.
There was some existing code in stop_scan_complete trying to avoid the
timer when a connect request interrupts a discovery procedure, but the
other way around was not covered. This patch covers both scenarios by
canceling the timer as soon as we get a successful command complete for
the disabling HCI command.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r-- | net/bluetooth/hci_event.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index a1075c713a9d..e3335b03c992 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1018,6 +1018,11 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1018 | break; | 1018 | break; |
1019 | 1019 | ||
1020 | case LE_SCAN_DISABLE: | 1020 | case LE_SCAN_DISABLE: |
1021 | /* Cancel this timer so that we don't try to disable scanning | ||
1022 | * when it's already disabled. | ||
1023 | */ | ||
1024 | cancel_delayed_work(&hdev->le_scan_disable); | ||
1025 | |||
1021 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); | 1026 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); |
1022 | break; | 1027 | break; |
1023 | 1028 | ||