diff options
-rw-r--r-- | net/bluetooth/hci_event.c | 6 | ||||
-rw-r--r-- | net/bluetooth/mgmt.c | 6 |
2 files changed, 10 insertions, 2 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index ecf885b79af1..0a936291f0e7 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -1094,8 +1094,12 @@ static void hci_cc_le_set_scan_enable(struct hci_dev *hdev, | |||
1094 | break; | 1094 | break; |
1095 | 1095 | ||
1096 | case LE_SCANNING_DISABLED: | 1096 | case LE_SCANNING_DISABLED: |
1097 | if (status) | 1097 | if (status) { |
1098 | hci_dev_lock(hdev); | ||
1099 | mgmt_stop_discovery_failed(hdev, status); | ||
1100 | hci_dev_unlock(hdev); | ||
1098 | return; | 1101 | return; |
1102 | } | ||
1099 | 1103 | ||
1100 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); | 1104 | clear_bit(HCI_LE_SCAN, &hdev->dev_flags); |
1101 | 1105 | ||
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 0ef4b6ca6e44..5fc741bab2bf 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2404,7 +2404,11 @@ static int stop_discovery(struct sock *sk, struct hci_dev *hdev, void *data, | |||
2404 | } | 2404 | } |
2405 | 2405 | ||
2406 | if (hdev->discovery.state == DISCOVERY_FINDING) { | 2406 | if (hdev->discovery.state == DISCOVERY_FINDING) { |
2407 | err = hci_cancel_inquiry(hdev); | 2407 | if (test_bit(HCI_INQUIRY, &hdev->flags)) |
2408 | err = hci_cancel_inquiry(hdev); | ||
2409 | else | ||
2410 | err = hci_cancel_le_scan(hdev); | ||
2411 | |||
2408 | if (err < 0) | 2412 | if (err < 0) |
2409 | mgmt_pending_remove(cmd); | 2413 | mgmt_pending_remove(cmd); |
2410 | else | 2414 | else |