Bluetooth: Add support for removing LTK's when pairing is removed
authorVinicius Costa Gomes <vinicius.gomes@openbossa.org>
Fri, 3 Feb 2012 00:08:03 +0000 (21:08 -0300)
committerJohan Hedberg <johan.hedberg@intel.com>
Mon, 13 Feb 2012 15:01:33 +0000 (17:01 +0200)
Instead of having a separated command for removing SMP keys, we use the
Remove Keys command to remove *all* keys.

Signed-off-by: Vinicius Costa Gomes <vinicius.gomes@openbossa.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
net/bluetooth/mgmt.c

index fd0b08115f2ea7fc8593a16259aa5c90b49df0a2..9e5dead1dbef1940425bec7d69837be855dd8df5 100644 (file)
@@ -1089,6 +1089,12 @@ static int remove_keys(struct sock *sk, u16 index, void *data, u16 len)
        bacpy(&rp.bdaddr, &cp->bdaddr);
        rp.status = MGMT_STATUS_FAILED;
 
+       err = hci_remove_ltk(hdev, &cp->bdaddr);
+       if (err < 0) {
+               err = cmd_status(sk, index, MGMT_OP_REMOVE_KEYS, -err);
+               goto unlock;
+       }
+
        err = hci_remove_link_key(hdev, &cp->bdaddr);
        if (err < 0) {
                rp.status = MGMT_STATUS_NOT_PAIRED;