Skip to content

Commit cc2b691

Browse files
Jakub Pawlowskiholtmann
authored andcommitted
Bluetooth: timeout handling in new connect procedure
Currently, when trying to connect to already paired device that just rotated its RPA MAC address, old address would be used and connection would fail. In order to fix that, kernel must scan and receive advertisement with fresh RPA before connecting. This patch makes sure that when new procedure is in use, and we're stuck in scan phase because no advertisement was received and timeout happened, or app decided to close socket, scan whitelist gets properly cleaned up. Signed-off-by: Jakub Pawlowski <[email protected]> Signed-off-by: Marcel Holtmann <[email protected]>
1 parent 28a667c commit cc2b691

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

net/bluetooth/hci_conn.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -382,8 +382,12 @@ static void hci_conn_timeout(struct work_struct *work)
382382
if (conn->out) {
383383
if (conn->type == ACL_LINK)
384384
hci_acl_create_connection_cancel(conn);
385-
else if (conn->type == LE_LINK)
386-
hci_le_create_connection_cancel(conn);
385+
else if (conn->type == LE_LINK) {
386+
if (test_bit(HCI_CONN_SCANNING, &conn->flags))
387+
hci_connect_le_scan_remove(conn);
388+
else
389+
hci_le_create_connection_cancel(conn);
390+
}
387391
} else if (conn->type == SCO_LINK || conn->type == ESCO_LINK) {
388392
hci_reject_sco(conn);
389393
}

0 commit comments

Comments
 (0)