Skip to contentSkip to conversation

Bluetooth: Expire RPA if encryption fails

PATCH In review [email protected] 2 participants 2 messages Sep 11, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Expire RPA if encryption fails

From: Johan Hedberg <[email protected]>

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.

---
 net/bluetooth/hci_event.c | 6 ++++++
 1 file changed, 6 insertions(+)
net/bluetooth/hci_event.c +6 -0
index 603a17cc52ac..edf05fda017e 100644
@@ -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) {
Signature · 1 line
1.9.3
maintainer
#1 lore raw

Hi Johan,

Quoted 9 lines

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.

---
net/bluetooth/hci_event.c | 6 ++++++

1 file changed, 6 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel