aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/bluetooth/hci_core.c4
-rw-r--r--net/bluetooth/smp.c27
2 files changed, 28 insertions, 3 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 6c3220e9484f..2fa9f2b2bee3 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3160,6 +3160,10 @@ static bool hci_persistent_key(struct hci_dev *hdev, struct hci_conn *conn,
3160 if (!conn) 3160 if (!conn)
3161 return true; 3161 return true;
3162 3162
3163 /* BR/EDR key derived using SC from an LE link */
3164 if (conn->type == LE_LINK)
3165 return true;
3166
3163 /* Neither local nor remote side had no-bonding as requirement */ 3167 /* Neither local nor remote side had no-bonding as requirement */
3164 if (conn->auth_type > 0x01 && conn->remote_auth > 0x01) 3168 if (conn->auth_type > 0x01 && conn->remote_auth > 0x01)
3165 return true; 3169 return true;
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index b6cdb553ccd3..a322019610eb 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -965,9 +965,30 @@ static void smp_notify_keys(struct l2cap_conn *conn)
965 } 965 }
966 966
967 if (smp->link_key) { 967 if (smp->link_key) {
968 hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst, 968 struct link_key *key;
969 smp->link_key, HCI_LK_AUTH_COMBINATION_P256, 969 u8 type;
970 0, NULL); 970
971 if (test_bit(SMP_FLAG_DEBUG_KEY, &smp->flags))
972 type = HCI_LK_DEBUG_COMBINATION;
973 else if (hcon->sec_level == BT_SECURITY_FIPS)
974 type = HCI_LK_AUTH_COMBINATION_P256;
975 else
976 type = HCI_LK_UNAUTH_COMBINATION_P256;
977
978 key = hci_add_link_key(hdev, smp->conn->hcon, &hcon->dst,
979 smp->link_key, type, 0, &persistent);
980 if (key) {
981 mgmt_new_link_key(hdev, key, persistent);
982
983 /* Don't keep debug keys around if the relevant
984 * flag is not set.
985 */
986 if (!test_bit(HCI_KEEP_DEBUG_KEYS, &hdev->dev_flags) &&
987 key->type == HCI_LK_DEBUG_COMBINATION) {
988 list_del_rcu(&key->list);
989 kfree_rcu(key, rcu);
990 }
991 }
971 } 992 }
972} 993}
973 994