diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-21 09:40:33 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-21 11:48:20 -0500 |
commit | 5400c044f3fac38f521362d76711e4c170f78b89 (patch) | |
tree | b16f41732384e8a23ff68e0eb18e0e623a1d2d9f | |
parent | b5235a65ad19f47c5995f054d3dcce90570d1a1c (diff) |
Bluetooth: mgmt: Fix set_fast_connectable error return
This patch ensures that Set Fast Connectable fails apropriately if we
are not already in a connectable state (which is a pre-requisite for
fast connectable).
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r-- | net/bluetooth/mgmt.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 03a13843cd16..563190c9f7b0 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -2560,6 +2560,13 @@ static int set_fast_connectable(struct sock *sk, u16 index, | |||
2560 | if (!hdev) | 2560 | if (!hdev) |
2561 | return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE, | 2561 | return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE, |
2562 | MGMT_STATUS_INVALID_PARAMS); | 2562 | MGMT_STATUS_INVALID_PARAMS); |
2563 | if (!hdev_is_powered(hdev)) | ||
2564 | return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE, | ||
2565 | MGMT_STATUS_NOT_POWERED); | ||
2566 | |||
2567 | if (!test_bit(HCI_CONNECTABLE, &hdev->dev_flags)) | ||
2568 | return cmd_status(sk, index, MGMT_OP_SET_FAST_CONNECTABLE, | ||
2569 | MGMT_STATUS_REJECTED); | ||
2563 | 2570 | ||
2564 | hci_dev_lock(hdev); | 2571 | hci_dev_lock(hdev); |
2565 | 2572 | ||