Skip to content

Commit

Permalink
Bluetooth: Expire RPA if encryption fails
Browse files Browse the repository at this point in the history
If encryption fails and we're using an RPA it may be because of a
conflict with another device. To avoid repeated failures the safest
action is to simply mark the RPA as expired so that a new one gets
generated as soon as the connection drops.

Signed-off-by: Johan Hedberg <[email protected]>
Signed-off-by: Marcel Holtmann <[email protected]>
  • Loading branch information
Johan Hedberg authored and holtmann committed Sep 11, 2014
1 parent 5be5e27 commit 7ed3fa2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions net/bluetooth/hci_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -2438,6 +2438,12 @@ static void hci_encrypt_change_evt(struct hci_dev *hdev, struct sk_buff *skb)
}
}

/* We should disregard the current RPA and generate a new one
* whenever the encryption procedure fails.
*/
if (ev->status && conn->type == LE_LINK)
set_bit(HCI_RPA_EXPIRED, &hdev->dev_flags);

clear_bit(HCI_CONN_ENCRYPT_PEND, &conn->flags);

if (ev->status && conn->state == BT_CONNECTED) {
Expand Down

0 comments on commit 7ed3fa2

Please sign in to comment.