aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_event.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth/hci_event.c')
-rw-r--r--net/bluetooth/hci_event.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index b0fdeec2f2ca..c92c5a020fe7 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -3066,12 +3066,6 @@ static void hci_link_key_request_evt(struct hci_dev *hdev, struct sk_buff *skb)
3066 BT_DBG("%s found key type %u for %pMR", hdev->name, key->type, 3066 BT_DBG("%s found key type %u for %pMR", hdev->name, key->type,
3067 &ev->bdaddr); 3067 &ev->bdaddr);
3068 3068
3069 if (!test_bit(HCI_KEEP_DEBUG_KEYS, &hdev->dev_flags) &&
3070 key->type == HCI_LK_DEBUG_COMBINATION) {
3071 BT_DBG("%s ignoring debug key", hdev->name);
3072 goto not_found;
3073 }
3074
3075 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr); 3069 conn = hci_conn_hash_lookup_ba(hdev, ACL_LINK, &ev->bdaddr);
3076 if (conn) { 3070 if (conn) {
3077 if ((key->type == HCI_LK_UNAUTH_COMBINATION_P192 || 3071 if ((key->type == HCI_LK_UNAUTH_COMBINATION_P192 ||
@@ -3141,8 +3135,18 @@ static void hci_link_key_notify_evt(struct hci_dev *hdev, struct sk_buff *skb)
3141 3135
3142 mgmt_new_link_key(hdev, key, persistent); 3136 mgmt_new_link_key(hdev, key, persistent);
3143 3137
3144 if (conn) 3138 /* Keep debug keys around only if the HCI_KEEP_DEBUG_KEYS flag
3139 * is set. If it's not set simply remove the key from the kernel
3140 * list (we've still notified user space about it but with
3141 * store_hint being 0).
3142 */
3143 if (key->type == HCI_LK_DEBUG_COMBINATION &&
3144 !test_bit(HCI_KEEP_DEBUG_KEYS, &hdev->dev_flags)) {
3145 list_del(&key->list);
3146 kfree(key);
3147 } else if (conn) {
3145 conn->flush_key = !persistent; 3148 conn->flush_key = !persistent;
3149 }
3146 3150
3147unlock: 3151unlock:
3148 hci_dev_unlock(hdev); 3152 hci_dev_unlock(hdev);