Skip to contentSkip to conversation

Bluetooth: Fix re-setting RPA as expired when deferring update

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

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

PATCH 1/1 Bluetooth: Fix re-setting RPA as expired when deferring update

From: Johan Hedberg <[email protected]>

The hci_update_random_address will clear the RPA_EXPIRED flag and proceed with setting a new one if the flag was set. However, the set_random_addr() function that is called may choose to defer the update to a later moment. In such a case the flag would incorrectly remain unset unless set_random_addr() re-sets it. This patch fixes the issue.

---
 net/bluetooth/hci_core.c | 1 +
 1 file changed, 1 insertion(+)
net/bluetooth/hci_core.c +1 -0
index 0d3782ad9a5b..067526d9680d 100644
@@ -3872,6 +3872,7 @@ static void set_random_addr(struct hci_request *req, bdaddr_t *rpa)
 	if (test_bit(HCI_LE_ADV, &hdev->dev_flags) ||
 	    hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT)) {
 		BT_DBG("Deferring random address update");
+		set_bit(HCI_RPA_EXPIRED, &hdev->dev_flags);
 		return;
 	}
 
Signature · 1 line
1.9.3
maintainer
#1 lore raw

Hi Johan,

Quoted 10 lines

The hci_update_random_address will clear the RPA_EXPIRED flag and proceed with setting a new one if the flag was set. However, the set_random_addr() function that is called may choose to defer the update to a later moment. In such a case the flag would incorrectly remain unset unless set_random_addr() re-sets it. This patch fixes the issue.

---
net/bluetooth/hci_core.c | 1 +

1 file changed, 1 insertion(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel