aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth/mgmt.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-02-18 10:14:31 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-02-18 11:58:20 -0500
commite0b2b27e622da0ba8a3d253b985d3d8f174b4313 (patch)
tree667dcec52ed49711b1563bff486a164029be5614 /net/bluetooth/mgmt.c
parent6131ddc8eb9bad8c4ff37e097b2537c819b76cc0 (diff)
Bluetooth: Fix missing address type check for removing LTKs
When removing Long Term Keys we should also be checking that the given address type (public vs random) matches. This patch updates the hci_remove_ltk function to take an extra parameter and uses it for address type matching. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/mgmt.c')
-rw-r--r--net/bluetooth/mgmt.c14
1 files changed, 11 insertions, 3 deletions
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,