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>
This commit is contained in:
Johan Hedberg 2015-10-16 10:07:53 +03:00 committed by Marcel Holtmann
parent 679d2b6f9d
commit 9ad3e6ffe1
1 changed files with 19 additions and 4 deletions

View File

@ -91,12 +91,27 @@ static void hci_connect_le_scan_cleanup(struct hci_conn *conn)
* autoconnect action, remove them completely. If they are, just unmark * autoconnect action, remove them completely. If they are, just unmark
* them as waiting for connection, by clearing explicit_connect field. * them as waiting for connection, by clearing explicit_connect field.
*/ */
if (params->auto_connect == HCI_AUTO_CONN_EXPLICIT) { params->explicit_connect = false;
list_del_init(&params->action);
switch (params->auto_connect) {
case HCI_AUTO_CONN_EXPLICIT:
hci_conn_params_del(conn->hdev, bdaddr, bdaddr_type); hci_conn_params_del(conn->hdev, bdaddr, bdaddr_type);
} else { /* return instead of break to avoid duplicate scan update */
params->explicit_connect = false; return;
hci_update_background_scan(conn->hdev); case HCI_AUTO_CONN_DIRECT:
case HCI_AUTO_CONN_ALWAYS:
list_add(&params->action, &conn->hdev->pend_le_conns);
break;
case HCI_AUTO_CONN_REPORT:
list_add(&params->action, &conn->hdev->pend_le_reports);
break;
default:
break;
} }
hci_update_background_scan(conn->hdev);
} }
static void hci_conn_cleanup(struct hci_conn *conn) static void hci_conn_cleanup(struct hci_conn *conn)