summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_core.c
diff options
context:
space:
mode:
authorJohan Hedberg2014-12-03 11:43:39 +0100
committerMarcel Holtmann2014-12-03 16:51:22 +0100
commit923e24143efe654553cabdb08f369d3789413147 (patch)
tree858d8ecb70983a376367886dbaf7f40f29f4ddf6 /net/bluetooth/hci_core.c
parentBluetooth: Organize SMP crypto functions to logical sections (diff)
downloadkernel-qcow2-linux-923e24143efe654553cabdb08f369d3789413147.tar.gz
kernel-qcow2-linux-923e24143efe654553cabdb08f369d3789413147.tar.xz
kernel-qcow2-linux-923e24143efe654553cabdb08f369d3789413147.zip
Bluetooth: Fix SMP debug key handling
We need to keep debug keys around at least until the point that they are used - otherwise e.g. slave role behavior wouldn't work as there'd be no key to be looked up. The correct behavior should therefore be to return any stored keys but when we clean up the SMP context to remove the key from the hdev list if keeping debug keys around hasn't been requestsed. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_core.c')
-rw-r--r--net/bluetooth/hci_core.c10
1 files changed, 1 insertions, 9 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index c8123f04a33c..f0018562b028 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -3246,15 +3246,7 @@ struct smp_ltk *hci_find_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr,
if (addr_type != k->bdaddr_type || bacmp(bdaddr, &k->bdaddr))
continue;
- if (smp_ltk_is_sc(k)) {
- if (k->type == SMP_LTK_P256_DEBUG &&
- !test_bit(HCI_KEEP_DEBUG_KEYS, &hdev->dev_flags))
- continue;
- rcu_read_unlock();
- return k;
- }
-
- if (ltk_role(k->type) == role) {
+ if (smp_ltk_is_sc(k) || ltk_role(k->type) == role) {
rcu_read_unlock();
return k;
}