diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-22 09:35:26 -0500 |
---|---|---|
committer | Johan Hedberg <johan.hedberg@intel.com> | 2012-02-23 06:06:59 -0500 |
commit | 6c8f12c143fe83485afa530320e6f70dfc1aad54 (patch) | |
tree | 945ef87b51a0783e7b11e6c310f65113743a6fcc /net/bluetooth | |
parent | 97e0bdeb93cc9bd014c21d5400af4fa7f2fe2f91 (diff) |
Bluetooth: mgmt: Fix Set SSP supported check
The test for SSP support needs to be earlier in the set_ssp function so
that we return an error when SSP is not supported even when the device
is powered off.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/mgmt.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c index 8b4df0473ec3..ac8ba839a78b 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -1141,6 +1141,12 @@ static int set_ssp(struct sock *sk, u16 index, void *data, u16 len) | |||
1141 | 1141 | ||
1142 | hci_dev_lock(hdev); | 1142 | hci_dev_lock(hdev); |
1143 | 1143 | ||
1144 | if (!(hdev->features[6] & LMP_SIMPLE_PAIR)) { | ||
1145 | err = cmd_status(sk, index, MGMT_OP_SET_SSP, | ||
1146 | MGMT_STATUS_NOT_SUPPORTED); | ||
1147 | goto failed; | ||
1148 | } | ||
1149 | |||
1144 | val = !!cp->val; | 1150 | val = !!cp->val; |
1145 | 1151 | ||
1146 | if (!hdev_is_powered(hdev)) { | 1152 | if (!hdev_is_powered(hdev)) { |
@@ -1161,12 +1167,6 @@ static int set_ssp(struct sock *sk, u16 index, void *data, u16 len) | |||
1161 | goto failed; | 1167 | goto failed; |
1162 | } | 1168 | } |
1163 | 1169 | ||
1164 | if (!(hdev->features[6] & LMP_SIMPLE_PAIR)) { | ||
1165 | err = cmd_status(sk, index, MGMT_OP_SET_SSP, | ||
1166 | MGMT_STATUS_NOT_SUPPORTED); | ||
1167 | goto failed; | ||
1168 | } | ||
1169 | |||
1170 | if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) { | 1170 | if (mgmt_pending_find(MGMT_OP_SET_SSP, hdev)) { |
1171 | err = cmd_status(sk, index, MGMT_OP_SET_SSP, MGMT_STATUS_BUSY); | 1171 | err = cmd_status(sk, index, MGMT_OP_SET_SSP, MGMT_STATUS_BUSY); |
1172 | goto failed; | 1172 | goto failed; |