Skip to content

Commit 5cd3970

Browse files
apusakaVudentz
authored andcommitted
Bluetooth: Make sure LE create conn cancel is sent when timeout
When sending LE create conn command, we set a timer with a duration of HCI_LE_CONN_TIMEOUT before timing out and calling create_le_conn_complete. Additionally, when receiving the command complete, we also set a timer with the same duration to call le_conn_timeout. Usually the latter will be triggered first, which then sends a LE create conn cancel command. However, due to the nature of racing, it is possible for the former to be called first, thereby calling the chain hci_conn_failed -> hci_conn_del -> cancel_delayed_work, thereby preventing LE create conn cancel to be sent. In this situation, the controller will be stuck in trying the LE connection. This patch flushes le_conn_timeout on create_le_conn_complete to make sure we always send LE create connection cancel, if necessary. Signed-off-by: Archie Pusaka <apusaka@chromium.org> Reviewed-by: Ying Hsu <yinghsu@chromium.org> Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
1 parent 0f00cd3 commit 5cd3970

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

net/bluetooth/hci_conn.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,8 @@ static void create_le_conn_complete(struct hci_dev *hdev, void *data, int err)
12501250
if (conn != hci_lookup_le_connect(hdev))
12511251
goto done;
12521252

1253+
/* Flush to make sure we send create conn cancel command if needed */
1254+
flush_delayed_work(&conn->le_conn_timeout);
12531255
hci_conn_failed(conn, bt_status(err));
12541256

12551257
done:

0 commit comments

Comments
 (0)