diff options
author | John W. Linville <linville@tuxdriver.com> | 2012-06-13 15:35:35 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-06-13 15:35:35 -0400 |
commit | 211c17aaee644bb808fbdeef547ac99db92c01ed (patch) | |
tree | 2acf7fe32b30f537b06fed7e4c536ef0d11f2902 /net/bluetooth/smp.c | |
parent | ec8eb9ae5819da011ac574aa290207a2a47cdbae (diff) | |
parent | bcb7ad7bcbef030e6ba71ede1f9866368aca7c99 (diff) |
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Conflicts:
drivers/net/wireless/ath/ath9k/main.c
net/bluetooth/hci_event.c
Diffstat (limited to 'net/bluetooth/smp.c')
-rw-r--r-- | net/bluetooth/smp.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c index ff4835b61de9..16ef0dc85a0a 100644 --- a/net/bluetooth/smp.c +++ b/net/bluetooth/smp.c | |||
@@ -649,7 +649,7 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb) | |||
649 | 649 | ||
650 | auth |= (req->auth_req | rsp->auth_req) & SMP_AUTH_MITM; | 650 | auth |= (req->auth_req | rsp->auth_req) & SMP_AUTH_MITM; |
651 | 651 | ||
652 | ret = tk_request(conn, 0, auth, rsp->io_capability, req->io_capability); | 652 | ret = tk_request(conn, 0, auth, req->io_capability, rsp->io_capability); |
653 | if (ret) | 653 | if (ret) |
654 | return SMP_UNSPECIFIED; | 654 | return SMP_UNSPECIFIED; |
655 | 655 | ||
@@ -704,7 +704,7 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb) | |||
704 | return 0; | 704 | return 0; |
705 | } | 705 | } |
706 | 706 | ||
707 | static u8 smp_ltk_encrypt(struct l2cap_conn *conn) | 707 | static u8 smp_ltk_encrypt(struct l2cap_conn *conn, u8 sec_level) |
708 | { | 708 | { |
709 | struct smp_ltk *key; | 709 | struct smp_ltk *key; |
710 | struct hci_conn *hcon = conn->hcon; | 710 | struct hci_conn *hcon = conn->hcon; |
@@ -713,6 +713,9 @@ static u8 smp_ltk_encrypt(struct l2cap_conn *conn) | |||
713 | if (!key) | 713 | if (!key) |
714 | return 0; | 714 | return 0; |
715 | 715 | ||
716 | if (sec_level > BT_SECURITY_MEDIUM && !key->authenticated) | ||
717 | return 0; | ||
718 | |||
716 | if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) | 719 | if (test_and_set_bit(HCI_CONN_ENCRYPT_PEND, &hcon->flags)) |
717 | return 1; | 720 | return 1; |
718 | 721 | ||
@@ -733,7 +736,7 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb) | |||
733 | 736 | ||
734 | hcon->pending_sec_level = authreq_to_seclevel(rp->auth_req); | 737 | hcon->pending_sec_level = authreq_to_seclevel(rp->auth_req); |
735 | 738 | ||
736 | if (smp_ltk_encrypt(conn)) | 739 | if (smp_ltk_encrypt(conn, hcon->pending_sec_level)) |
737 | return 0; | 740 | return 0; |
738 | 741 | ||
739 | if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) | 742 | if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) |
@@ -772,7 +775,7 @@ int smp_conn_security(struct l2cap_conn *conn, __u8 sec_level) | |||
772 | return 1; | 775 | return 1; |
773 | 776 | ||
774 | if (hcon->link_mode & HCI_LM_MASTER) | 777 | if (hcon->link_mode & HCI_LM_MASTER) |
775 | if (smp_ltk_encrypt(conn)) | 778 | if (smp_ltk_encrypt(conn, sec_level)) |
776 | goto done; | 779 | goto done; |
777 | 780 | ||
778 | if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) | 781 | if (test_and_set_bit(HCI_CONN_LE_SMP_PEND, &hcon->flags)) |