summaryrefslogtreecommitdiffstats
path: root/net/bluetooth/hci_conn.c
diff options
context:
space:
mode:
authorJakub Pawlowski <jpawlowski@google.com>2015-10-16 09:07:54 +0200
committerMarcel Holtmann <marcel@holtmann.org>2015-10-16 09:24:41 +0200
commit5157b8a503fa834e8569c7fed06981e3d3d53db0 (patch)
treebc7242ad64be49ba6db2437df4503070d9e6763b /net/bluetooth/hci_conn.c
parentBluetooth: Fix conn_params list update in hci_connect_le_scan_cleanup (diff)
downloadlinux-5157b8a503fa834e8569c7fed06981e3d3d53db0.tar.xz
linux-5157b8a503fa834e8569c7fed06981e3d3d53db0.zip
Bluetooth: Fix initializing conn_params in scan phase
This patch makes sure that conn_params that were created just for explicit_connect, will get properly deleted during cleanup. Signed-off-by: Jakub Pawlowski <jpawlowski@google.com> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth/hci_conn.c')
-rw-r--r--net/bluetooth/hci_conn.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index fe99025fb649..2dda439c8cb8 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1008,15 +1008,23 @@ static int hci_explicit_conn_params_set(struct hci_request *req,
if (is_connected(hdev, addr, addr_type))
return -EISCONN;
- params = hci_conn_params_add(hdev, addr, addr_type);
- if (!params)
- return -EIO;
+ params = hci_conn_params_lookup(hdev, addr, addr_type);
+ if (!params) {
+ params = hci_conn_params_add(hdev, addr, addr_type);
+ if (!params)
+ return -ENOMEM;
+
+ /* If we created new params, mark them to be deleted in
+ * hci_connect_le_scan_cleanup. It's different case than
+ * existing disabled params, those will stay after cleanup.
+ */
+ params->auto_connect = HCI_AUTO_CONN_EXPLICIT;
+ }
- /* If we created new params, or existing params were marked as disabled,
- * mark them to be used just once to connect.
- */
+ /* We're trying to connect, so make sure params are at pend_le_conns */
if (params->auto_connect == HCI_AUTO_CONN_DISABLED ||
- params->auto_connect == HCI_AUTO_CONN_REPORT) {
+ params->auto_connect == HCI_AUTO_CONN_REPORT ||
+ params->auto_connect == HCI_AUTO_CONN_EXPLICIT) {
list_del_init(&params->action);
list_add(&params->action, &hdev->pend_le_conns);
}