aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWaldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com>2011-05-31 09:49:25 -0400
committerGustavo F. Padovan <padovan@profusion.mobi>2011-06-08 15:58:18 -0400
commit19f8def031bfa50c579149b200bfeeb919727b27 (patch)
tree8f1fded6804d6e5d1537938f29b5e2c6f71e19fe
parent3581508571b513ed2e66d71f9708d6be907460fd (diff)
Bluetooth: Fix auth_complete_evt for legacy units
Legacy devices don't re-authenticate the link properly if a link key already exists. Thus, don't update sec_level for this case even if hci_auth_complete_evt indicates success. Otherwise the sec_level will not reflect a real security on the link. Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@tieto.com> Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
-rw-r--r--include/net/bluetooth/hci_core.h1
-rw-r--r--net/bluetooth/hci_conn.c2
-rw-r--r--net/bluetooth/hci_event.c12
3 files changed, 13 insertions, 2 deletions
diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
index af4b0ed173a8..0ac820dc35f7 100644
--- a/include/net/bluetooth/hci_core.h
+++ b/include/net/bluetooth/hci_core.h
@@ -322,6 +322,7 @@ void hci_inquiry_cache_update(struct hci_dev *hdev, struct inquiry_data *data);
322/* ----- HCI Connections ----- */ 322/* ----- HCI Connections ----- */
323enum { 323enum {
324 HCI_CONN_AUTH_PEND, 324 HCI_CONN_AUTH_PEND,
325 HCI_CONN_REAUTH_PEND,
325 HCI_CONN_ENCRYPT_PEND, 326 HCI_CONN_ENCRYPT_PEND,
326 HCI_CONN_RSWITCH_PEND, 327 HCI_CONN_RSWITCH_PEND,
327 HCI_CONN_MODE_CHANGE_PEND, 328 HCI_CONN_MODE_CHANGE_PEND,
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 3163330cd4f1..e67540216cd4 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -548,6 +548,8 @@ static int hci_conn_auth(struct hci_conn *conn, __u8 sec_level, __u8 auth_type)
548 cp.handle = cpu_to_le16(conn->handle); 548 cp.handle = cpu_to_le16(conn->handle);
549 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED, 549 hci_send_cmd(conn->hdev, HCI_OP_AUTH_REQUESTED,
550 sizeof(cp), &cp); 550 sizeof(cp), &cp);
551 if (conn->key_type != 0xff)
552 set_bit(HCI_CONN_REAUTH_PEND, &conn->pend);
551 } 553 }
552 554
553 return 0; 555 return 0;
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index a90200cac11d..33120b48cbc5 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -1489,13 +1489,21 @@ static inline void hci_auth_complete_evt(struct hci_dev *hdev, struct sk_buff *s
1489 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle)); 1489 conn = hci_conn_hash_lookup_handle(hdev, __le16_to_cpu(ev->handle));
1490 if (conn) { 1490 if (conn) {
1491 if (!ev->status) { 1491 if (!ev->status) {
1492 conn->link_mode |= HCI_LM_AUTH; 1492 if (!(conn->ssp_mode > 0 && hdev->ssp_mode > 0) &&
1493 conn->sec_level = conn->pending_sec_level; 1493 test_bit(HCI_CONN_REAUTH_PEND,
1494 &conn->pend)) {
1495 BT_INFO("re-auth of legacy device is not"
1496 "possible.");
1497 } else {
1498 conn->link_mode |= HCI_LM_AUTH;
1499 conn->sec_level = conn->pending_sec_level;
1500 }
1494 } else { 1501 } else {
1495 mgmt_auth_failed(hdev->id, &conn->dst, ev->status); 1502 mgmt_auth_failed(hdev->id, &conn->dst, ev->status);
1496 } 1503 }
1497 1504
1498 clear_bit(HCI_CONN_AUTH_PEND, &conn->pend); 1505 clear_bit(HCI_CONN_AUTH_PEND, &conn->pend);
1506 clear_bit(HCI_CONN_REAUTH_PEND, &conn->pend);
1499 1507
1500 if (conn->state == BT_CONFIG) { 1508 if (conn->state == BT_CONFIG) {
1501 if (!ev->status && hdev->ssp_mode > 0 && 1509 if (!ev->status && hdev->ssp_mode > 0 &&