aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2015-03-11 04:52:08 -0400
committerMarcel Holtmann <marcel@holtmann.org>2015-03-11 10:54:23 -0400
commit4ba9faf35f6e49964ca6ed88fb0090cc4c727bf3 (patch)
tree6c7c3bb1bad7c779ca7194c8c9d40a0790194c33 /net/bluetooth
parent87c8b28d291de9999e9da2ef5d4165861983eb83 (diff)
Bluetooth: Check for matching IRK when looking for paired LE devices
If we're given an RPA when checking whether we're paired or not, we should consult the local RPA storage whether there's a matching IRK. This we we ensure that hci_bdaddr_is_paired() gives the right result even when trying to pair a second time with the same device with an RPA. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 4eba9d6fc9a5..e3bbdd537b90 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2519,6 +2519,7 @@ void hci_remove_irk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 addr_type)
2519bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type) 2519bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
2520{ 2520{
2521 struct smp_ltk *k; 2521 struct smp_ltk *k;
2522 struct smp_irk *irk;
2522 u8 addr_type; 2523 u8 addr_type;
2523 2524
2524 if (type == BDADDR_BREDR) { 2525 if (type == BDADDR_BREDR) {
@@ -2533,6 +2534,12 @@ bool hci_bdaddr_is_paired(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 type)
2533 else 2534 else
2534 addr_type = ADDR_LE_DEV_RANDOM; 2535 addr_type = ADDR_LE_DEV_RANDOM;
2535 2536
2537 irk = hci_get_irk(hdev, bdaddr, addr_type);
2538 if (irk) {
2539 bdaddr = &irk->bdaddr;
2540 addr_type = irk->addr_type;
2541 }
2542
2536 rcu_read_lock(); 2543 rcu_read_lock();
2537 list_for_each_entry_rcu(k, &hdev->long_term_keys, list) { 2544 list_for_each_entry_rcu(k, &hdev->long_term_keys, list) {
2538 if (k->bdaddr_type == addr_type && !bacmp(bdaddr, &k->bdaddr)) { 2545 if (k->bdaddr_type == addr_type && !bacmp(bdaddr, &k->bdaddr)) {