diff options
author | Johan Hedberg <johan.hedberg@intel.com> | 2013-01-27 09:32:00 -0500 |
---|---|---|
committer | Gustavo Padovan <gustavo.padovan@collabora.co.uk> | 2013-02-01 12:50:18 -0500 |
commit | f0ff92fbfa14c1cf8c0346f1dde9c3eda26d5abf (patch) | |
tree | 0fe912f4c5f6d64f9e08ee77e6daf36d5caa3a82 /net/bluetooth | |
parent | c00d575bd550d3d57aeec2522defa0cea589560c (diff) |
Bluetooth: Fix link security setting when powering on
If a controller is powered on while the HCI_AUTO_OFF flag is set the
link security setting (HCI_LINK_SECURITY) might not be in sync with the
actual state of the controller (HCI_AUTH). This patch fixes the issue by
checking for inequality between the intended and actual settings and
sends a HCI_Write_Auth_Enable command if necessary.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
Diffstat (limited to 'net/bluetooth')
-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 fbc8edf7dc1f..ae7585de9c08 100644 --- a/net/bluetooth/mgmt.c +++ b/net/bluetooth/mgmt.c | |||
@@ -3073,6 +3073,8 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) | |||
3073 | mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match); | 3073 | mgmt_pending_foreach(MGMT_OP_SET_POWERED, hdev, settings_rsp, &match); |
3074 | 3074 | ||
3075 | if (powered) { | 3075 | if (powered) { |
3076 | u8 link_sec; | ||
3077 | |||
3076 | if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && | 3078 | if (test_bit(HCI_SSP_ENABLED, &hdev->dev_flags) && |
3077 | !lmp_host_ssp_capable(hdev)) { | 3079 | !lmp_host_ssp_capable(hdev)) { |
3078 | u8 ssp = 1; | 3080 | u8 ssp = 1; |
@@ -3096,6 +3098,11 @@ int mgmt_powered(struct hci_dev *hdev, u8 powered) | |||
3096 | sizeof(cp), &cp); | 3098 | sizeof(cp), &cp); |
3097 | } | 3099 | } |
3098 | 3100 | ||
3101 | link_sec = test_bit(HCI_LINK_SECURITY, &hdev->dev_flags); | ||
3102 | if (link_sec != test_bit(HCI_AUTH, &hdev->flags)) | ||
3103 | hci_send_cmd(hdev, HCI_OP_WRITE_AUTH_ENABLE, | ||
3104 | sizeof(link_sec), &link_sec); | ||
3105 | |||
3099 | if (lmp_bredr_capable(hdev)) { | 3106 | if (lmp_bredr_capable(hdev)) { |
3100 | set_bredr_scan(hdev); | 3107 | set_bredr_scan(hdev); |
3101 | update_class(hdev); | 3108 | update_class(hdev); |