aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2012-02-20 17:52:42 -0500
committerJohan Hedberg <johan.hedberg@intel.com>2012-02-20 18:05:16 -0500
commitcacaf52f51697f832a26e8fdaa7b8e85785085da (patch)
tree268e88396fa9c55ac639cb3084f47a07fc2207cb
parent1e16357480fdeaeff7c5572f1afba7835473fcb6 (diff)
Bluetooth: mgmt: Clear EIR data when disabling SSP
EIR shouldn't be enabled if SSP isn't enabled. This patch adds the clearing of EIR data when disabling SSP and restores the data when SSP is re-enabled. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org>
-rw-r--r--net/bluetooth/mgmt.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index aa0d64040fac..a5a2a6844aea 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -3250,6 +3250,18 @@ int mgmt_auth_enable_complete(struct hci_dev *hdev, u8 status)
3250 return err; 3250 return err;
3251} 3251}
3252 3252
3253static int clear_eir(struct hci_dev *hdev)
3254{
3255 struct hci_cp_write_eir cp;
3256
3257 if (!(hdev->features[6] & LMP_EXT_INQ))
3258 return 0;
3259
3260 memset(&cp, 0, sizeof(cp));
3261
3262 return hci_send_cmd(hdev, HCI_OP_WRITE_EIR, sizeof(cp), &cp);
3263}
3264
3253int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 status) 3265int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 status)
3254{ 3266{
3255 struct cmd_lookup match = { NULL, hdev }; 3267 struct cmd_lookup match = { NULL, hdev };
@@ -3268,9 +3280,15 @@ int mgmt_ssp_enable_complete(struct hci_dev *hdev, u8 status)
3268 ev = cpu_to_le32(get_current_settings(hdev)); 3280 ev = cpu_to_le32(get_current_settings(hdev));
3269 err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), match.sk); 3281 err = mgmt_event(MGMT_EV_NEW_SETTINGS, hdev, &ev, sizeof(ev), match.sk);
3270 3282
3271 if (match.sk) 3283 if (match.sk) {
3272 sock_put(match.sk); 3284 sock_put(match.sk);
3273 3285
3286 if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags))
3287 update_eir(hdev);
3288 else
3289 clear_eir(hdev);
3290 }
3291
3274 return err; 3292 return err;
3275} 3293}
3276 3294