Bluetooth: Set appearance only for LE capable controllers
authorMichał Narajowski <michal.narajowski@codecoup.pl>
Mon, 19 Sep 2016 12:33:33 +0000 (14:33 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 19 Sep 2016 18:48:22 +0000 (21:48 +0300)
Setting appearance on controllers without LE support will result
in No Supported error.

Signed-off-by: Michał Narajowski <michal.narajowski@codecoup.pl>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/mgmt.c

index cd9f345894e0c4257826f2e58a9f9c19d601a6bf..7b2bac492fb1cab0a80cf74306a98c6d1230f00e 100644 (file)
@@ -3178,6 +3178,10 @@ static int set_appearance(struct sock *sk, struct hci_dev *hdev, void *data,
 
        BT_DBG("");
 
+       if (!lmp_le_capable(hdev))
+               return mgmt_cmd_status(sk, hdev->id, MGMT_OP_SET_APPEARANCE,
+                                      MGMT_STATUS_NOT_SUPPORTED);
+
        apperance = le16_to_cpu(cp->appearance);
 
        hci_dev_lock(hdev);