Bluetooth: mgmt: Fix Set SSP check for supported feature
authorJohan Hedberg <johan.hedberg@intel.com>
Mon, 20 Feb 2012 21:53:46 +0000 (23:53 +0200)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 20 Feb 2012 22:32:16 +0000 (00:32 +0200)
If the local controller doesn't support SSP we should always return an
error for the Set SSP command.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/mgmt.c

index edf84c3..aa0d640 100644 (file)
@@ -1065,6 +1065,12 @@ static int set_ssp(struct sock *sk, u16 index, void *data, u16 len)
                goto failed;
        }
 
+       if (!(hdev->features[6] & LMP_SIMPLE_PAIR)) {
+               err = cmd_status(sk, index, MGMT_OP_SET_SSP,
+                                               MGMT_STATUS_NOT_SUPPORTED);
+               goto failed;
+       }
+
        if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) {
                err = cmd_status(sk, index, MGMT_OP_SET_SSP, MGMT_STATUS_BUSY);
                goto failed;