aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_core.c4
-rw-r--r--net/bluetooth/mgmt.c14
2 files changed, 13 insertions, 5 deletions
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 59a76b2566eb..957c8f4cc4c7 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2810,12 +2810,12 @@ int hci_remove_link_key(struct hci_dev *hdev, bdaddr_t *bdaddr)
2810 return 0; 2810 return 0;
2811} 2811}
2812 2812
2813int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr) 2813int hci_remove_ltk(struct hci_dev *hdev, bdaddr_t *bdaddr, u8 bdaddr_type)
2814{ 2814{
2815 struct smp_ltk *k, *tmp; 2815 struct smp_ltk *k, *tmp;
2816 2816
2817 list_for_each_entry_safe(k, tmp, &hdev->long_term_keys, list) { 2817 list_for_each_entry_safe(k, tmp, &hdev->long_term_keys, list) {
2818 if (bacmp(bdaddr, &k->bdaddr)) 2818 if (bacmp(bdaddr, &k->bdaddr) || k->bdaddr_type != bdaddr_type)
2819 continue; 2819 continue;
2820 2820
2821 BT_DBG("%s removing %pMR", hdev->name, bdaddr); 2821 BT_DBG("%s removing %pMR", hdev->name, bdaddr);
diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
index 782e2bb10881..473f8687b28b 100644
--- a/net/bluetooth/mgmt.c
+++ b/net/bluetooth/mgmt.c
@@ -2318,10 +2318,18 @@ static int unpair_device(struct sock *sk, struct hci_dev *hdev, void *data,
2318 goto unlock; 2318 goto unlock;
2319 } 2319 }
2320 2320
2321 if (cp->addr.type == BDADDR_BREDR) 2321 if (cp->addr.type == BDADDR_BREDR) {
2322 err = hci_remove_link_key(hdev, &cp->addr.bdaddr); 2322 err = hci_remove_link_key(hdev, &cp->addr.bdaddr);
2323 else 2323 } else {
2324 err = hci_remove_ltk(hdev, &cp->addr.bdaddr); 2324 u8 addr_type;
2325
2326 if (cp->addr.type == BDADDR_LE_PUBLIC)
2327 addr_type = ADDR_LE_DEV_PUBLIC;
2328 else
2329 addr_type = ADDR_LE_DEV_RANDOM;
2330
2331 err = hci_remove_ltk(hdev, &cp->addr.bdaddr, addr_type);
2332 }
2325 2333
2326 if (err < 0) { 2334 if (err < 0) {
2327 err = cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE, 2335 err = cmd_complete(sk, hdev->id, MGMT_OP_UNPAIR_DEVICE,