Thread (2 messages) flat view 2 messages, 2 authors, 2021-11-30
STALE1753d

[PATCH] Bluetooth: HCI: Fix authentication failure error during pairing

From: Sathish Narasimman <hidden>
Date: 2021-11-30 09:54:07
Subsystem: bluetooth subsystem, the rest · Maintainers: Marcel Holtmann, Luiz Augusto von Dentz, Linus Torvalds

When Experimental LL_Privacy enabled & Privacy is set to device mode the
pairing of 2 linux devices fails with authentication failure error. This
happens only on the 2nd attempt when we swap the advertiser/initiator
role. This is because the init_addr is updated with dev->rpa which still
holds the previous connection RPA. This patch fixes the issue when
ll_privacy is enabled.

Signed-off-by: Sathish Narasimman <redacted>
---
 net/bluetooth/hci_event.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index 9d8d2d9e5d1f..bd40d8cedc27 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -5314,8 +5314,10 @@ static void le_conn_update_addr(struct hci_conn *conn, bdaddr_t *bdaddr,
 			conn->init_addr_type = ADDR_LE_DEV_RANDOM;
 			bacpy(&conn->init_addr, local_rpa);
 		} else if (hci_dev_test_flag(conn->hdev, HCI_PRIVACY)) {
-			conn->init_addr_type = ADDR_LE_DEV_RANDOM;
-			bacpy(&conn->init_addr, &conn->hdev->rpa);
+			if (!use_ll_privacy(conn->hdev)) {
+				conn->init_addr_type = ADDR_LE_DEV_RANDOM;
+				bacpy(&conn->init_addr, &conn->hdev->rpa);
+			}
 		} else {
 			hci_copy_identity_address(conn->hdev, &conn->init_addr,
 						  &conn->init_addr_type);
-- 
2.17.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help