aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2013-10-02 03:27:02 -0400
committerJohan Hedberg <johan.hedberg@intel.com>2013-10-02 06:51:50 -0400
commita0cdf960bec0b040307229bc25c40fa33c20dff1 (patch)
tree715cbd9cd9e66d9b588d84467c88eadb6024e0e9 /net/bluetooth/mgmt.c
parent0663ca2a032eea12480a8f86fe08bef9d72f8faf (diff)
Bluetooth: Restrict disabling of HS when controller is powered off
Disabling the high speed setting when the controller is powered on has too many side effects that are not taken care of. And in general it is not an useful operation anyway. So just make such a command fail with a rejection error message. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index dcce0cf1d7cc..4ac31695946b 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1353,10 +1353,17 @@ static int set_hs(struct sock *sk, struct hci_dev *hdev, void *data, u16 len)
1353 1353
1354 hci_dev_lock(hdev); 1354 hci_dev_lock(hdev);
1355 1355
1356 if (cp->val) 1356 if (cp->val) {
1357 changed = !test_and_set_bit(HCI_HS_ENABLED, &hdev->dev_flags); 1357 changed = !test_and_set_bit(HCI_HS_ENABLED, &hdev->dev_flags);
1358 else 1358 } else {
1359 if (hdev_is_powered(hdev)) {
1360 err = cmd_status(sk, hdev->id, MGMT_OP_SET_HS,
1361 MGMT_STATUS_REJECTED);
1362 goto unlock;
1363 }
1364
1359 changed = test_and_clear_bit(HCI_HS_ENABLED, &hdev->dev_flags); 1365 changed = test_and_clear_bit(HCI_HS_ENABLED, &hdev->dev_flags);
1366 }
1360 1367
1361 err = send_settings_rsp(sk, MGMT_OP_SET_HS, hdev); 1368 err = send_settings_rsp(sk, MGMT_OP_SET_HS, hdev);
1362 if (err < 0) 1369 if (err < 0)