Skip to content

Commit 9ad3e6f

Browse files
Johan Hedbergholtmann
authored andcommitted
Bluetooth: Fix conn_params list update in hci_connect_le_scan_cleanup
After clearing the params->explicit_connect variable the parameters may need to be either added back to the right list or potentially left absent from both the le_reports and the le_conns lists. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
1 parent 679d2b6 commit 9ad3e6f

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

net/bluetooth/hci_conn.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,27 @@ static void hci_connect_le_scan_cleanup(struct hci_conn *conn)
9191
* autoconnect action, remove them completely. If they are, just unmark
9292
* them as waiting for connection, by clearing explicit_connect field.
9393
*/
94-
if (params->auto_connect == HCI_AUTO_CONN_EXPLICIT) {
94+
params->explicit_connect = false;
95+
96+
list_del_init(&params->action);
97+
98+
switch (params->auto_connect) {
99+
case HCI_AUTO_CONN_EXPLICIT:
95100
hci_conn_params_del(conn->hdev, bdaddr, bdaddr_type);
96-
} else {
97-
params->explicit_connect = false;
98-
hci_update_background_scan(conn->hdev);
101+
/* return instead of break to avoid duplicate scan update */
102+
return;
103+
case HCI_AUTO_CONN_DIRECT:
104+
case HCI_AUTO_CONN_ALWAYS:
105+
list_add(&params->action, &conn->hdev->pend_le_conns);
106+
break;
107+
case HCI_AUTO_CONN_REPORT:
108+
list_add(&params->action, &conn->hdev->pend_le_reports);
109+
break;
110+
default:
111+
break;
99112
}
113+
114+
hci_update_background_scan(conn->hdev);
100115
}
101116

102117
static void hci_conn_cleanup(struct hci_conn *conn)

0 commit comments

Comments
 (0)