summaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2013-01-09 15:29:36 +0200
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>2013-01-10 06:09:26 -0200
commitee98f4738050bb93823ce9ba849f5d78f5b8c1a1 (patch)
tree80f443a5764d39168015265ac3a93239ceb9c7c3 /net/bluetooth
parent575b3a02e20a10bb8110378ef363a8a174018680 (diff)
downloadlinux-ee98f4738050bb93823ce9ba849f5d78f5b8c1a1.tar.gz
linux-ee98f4738050bb93823ce9ba849f5d78f5b8c1a1.tar.bz2
linux-ee98f4738050bb93823ce9ba849f5d78f5b8c1a1.zip
Bluetooth: Fix accepting set_dev_class for non-BR/EDR controllers
The concept of Class of Device only exists for BR/EDR controllers. The mgmt_set_dev_class command should therefore return a proper "not supported" error if it is attempted for a controller that doesn't support BR/EDR (e.g. a single mode LE-only one). 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.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index f3fec4264dcf..d78ce81d2cf4 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -1424,6 +1424,12 @@ static int set_dev_class(struct sock *sk, struct hci_dev *hdev, void *data,
hci_dev_lock(hdev);
+ if (!lmp_bredr_capable(hdev)) {
+ err = cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
+ MGMT_STATUS_NOT_SUPPORTED);
+ goto unlock;
+ }
+
if (test_bit(HCI_PENDING_CLASS, &hdev->dev_flags)) {
err = cmd_status(sk, hdev->id, MGMT_OP_SET_DEV_CLASS,
MGMT_STATUS_BUSY);