]> git.proxmox.com Git - mirror_ubuntu-focal-kernel.git/commitdiff
Bluetooth: Fix accepting set_dev_class for non-BR/EDR controllers
authorJohan Hedberg <johan.hedberg@intel.com>
Wed, 9 Jan 2013 13:29:36 +0000 (15:29 +0200)
committerGustavo Padovan <gustavo.padovan@collabora.co.uk>
Thu, 10 Jan 2013 08:09:26 +0000 (06:09 -0200)
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>
net/bluetooth/mgmt.c

index f3fec4264dcff2e2f3e71a894645cbb0cd973b04..d78ce81d2cf477450ed6e6d1b19676e5f17b135e 100644 (file)
@@ -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);