aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-10-24 14:11:58 -0400
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2012-11-01 18:26:56 -0400
commit33c525c0a37abd136f014f473f5a2efddba58167 (patch)
treeb46cd6dd9d02c91423e0e9db1959d1c87426c256 /net/bluetooth
parent7f0ae647b29ba80d5a1127804ba478e3de8a6b4c (diff)
Bluetooth: mgmt: Restrict BR/EDR settings to BR/EDR-only adapters
This patch makes sure that settings which are specific for BR/EDR capable adapters are not allowed for non-BR/EDR (e.g. LE-only) adapters. Instead, a "not supported" error is returned of such a setting is attempted to be set for a non-BR/EDR adapter. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/mgmt.c22
1 files changed, 19 insertions, 3 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index e86d08731b4e..11cabe7ef3c6 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -376,15 +376,15 @@ static u32 get_supported_settings(struct hci_dev *hdev)
376 u32 settings = 0; 376 u32 settings = 0;
377 377
378 settings |= MGMT_SETTING_POWERED; 378 settings |= MGMT_SETTING_POWERED;
379 settings |= MGMT_SETTING_CONNECTABLE;
380 settings |= MGMT_SETTING_FAST_CONNECTABLE;
381 settings |= MGMT_SETTING_DISCOVERABLE;
382 settings |= MGMT_SETTING_PAIRABLE; 379 settings |= MGMT_SETTING_PAIRABLE;
383 380
384 if (lmp_ssp_capable(hdev)) 381 if (lmp_ssp_capable(hdev))
385 settings |= MGMT_SETTING_SSP; 382 settings |= MGMT_SETTING_SSP;
386 383
387 if (lmp_bredr_capable(hdev)) { 384 if (lmp_bredr_capable(hdev)) {
385 settings |= MGMT_SETTING_CONNECTABLE;
386 settings |= MGMT_SETTING_FAST_CONNECTABLE;
387 settings |= MGMT_SETTING_DISCOVERABLE;
388 settings |= MGMT_SETTING_BREDR; 388 settings |= MGMT_SETTING_BREDR;
389 settings |= MGMT_SETTING_LINK_SECURITY; 389 settings |= MGMT_SETTING_LINK_SECURITY;
390 } 390 }
@@ -867,6 +867,10 @@ static int set_discoverable(struct sock *sk, struct hci_dev *hdev, void *data,
867 867
868 BT_DBG("request for %s", hdev->name); 868 BT_DBG("request for %s", hdev->name);
869 869
870 if (!lmp_bredr_capable(hdev))
871 return cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
872 MGMT_STATUS_NOT_SUPPORTED);
873
870 timeout = __le16_to_cpu(cp->timeout); 874 timeout = __le16_to_cpu(cp->timeout);
871 if (!cp->val && timeout > 0) 875 if (!cp->val && timeout > 0)
872 return cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE, 876 return cmd_status(sk, hdev->id, MGMT_OP_SET_DISCOVERABLE,
@@ -962,6 +966,10 @@ static int set_connectable(struct sock *sk, struct hci_dev *hdev, void *data,
962 966
963 BT_DBG("request for %s", hdev->name); 967 BT_DBG("request for %s", hdev->name);
964 968
969 if (!lmp_bredr_capable(hdev))
970 return cmd_status(sk, hdev->id, MGMT_OP_SET_CONNECTABLE,
971 MGMT_STATUS_NOT_SUPPORTED);
972
965 hci_dev_lock(hdev); 973 hci_dev_lock(hdev);
966 974
967 if (!hdev_is_powered(hdev)) { 975 if (!hdev_is_powered(hdev)) {
@@ -1060,6 +1068,10 @@ static int set_link_security(struct sock *sk, struct hci_dev *hdev, void *data,
1060 1068
1061 BT_DBG("request for %s", hdev->name); 1069 BT_DBG("request for %s", hdev->name);
1062 1070
1071 if (!lmp_bredr_capable(hdev))
1072 return cmd_status(sk, hdev->id, MGMT_OP_SET_LINK_SECURITY,
1073 MGMT_STATUS_NOT_SUPPORTED);
1074
1063 hci_dev_lock(hdev); 1075 hci_dev_lock(hdev);
1064 1076
1065 if (!hdev_is_powered(hdev)) { 1077 if (!hdev_is_powered(hdev)) {
@@ -2594,6 +2606,10 @@ static int set_fast_connectable(struct sock *sk, struct hci_dev *hdev,
2594 2606
2595 BT_DBG("%s", hdev->name); 2607 BT_DBG("%s", hdev->name);
2596 2608
2609 if (!lmp_bredr_capable(hdev))
2610 return cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
2611 MGMT_STATUS_NOT_SUPPORTED);
2612
2597 if (!hdev_is_powered(hdev)) 2613 if (!hdev_is_powered(hdev))
2598 return cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE, 2614 return cmd_status(sk, hdev->id, MGMT_OP_SET_FAST_CONNECTABLE,
2599 MGMT_STATUS_NOT_POWERED); 2615 MGMT_STATUS_NOT_POWERED);