diff options
author | Jakub Pawlowski <jpawlowski@google.com> | 2015-10-16 03:07:54 -0400 |
---|---|---|
committer | Marcel Holtmann <marcel@holtmann.org> | 2015-10-16 03:24:41 -0400 |
commit | 5157b8a503fa834e8569c7fed06981e3d3d53db0 (patch) | |
tree | bc7242ad64be49ba6db2437df4503070d9e6763b /net/bluetooth/hci_conn.c | |
parent | 9ad3e6ffe189a988389d88ce33101668cb2d54c6 (diff) |
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.c | 22 |
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, | |||
1008 | if (is_connected(hdev, addr, addr_type)) | 1008 | if (is_connected(hdev, addr, addr_type)) |
1009 | return -EISCONN; | 1009 | return -EISCONN; |
1010 | 1010 | ||
1011 | params = hci_conn_params_add(hdev, addr, addr_type); | 1011 | params = hci_conn_params_lookup(hdev, addr, addr_type); |
1012 | if (!params) | 1012 | if (!params) { |
1013 | return -EIO; | 1013 | params = hci_conn_params_add(hdev, addr, addr_type); |
1014 | if (!params) | ||
1015 | return -ENOMEM; | ||
1016 | |||
1017 | /* If we created new params, mark them to be deleted in | ||
1018 | * hci_connect_le_scan_cleanup. It's different case than | ||
1019 | * existing disabled params, those will stay after cleanup. | ||
1020 | */ | ||
1021 | params->auto_connect = HCI_AUTO_CONN_EXPLICIT; | ||
1022 | } | ||
1014 | 1023 | ||
1015 | /* If we created new params, or existing params were marked as disabled, | 1024 | /* We're trying to connect, so make sure params are at pend_le_conns */ |
1016 | * mark them to be used just once to connect. | ||
1017 | */ | ||
1018 | if (params->auto_connect == HCI_AUTO_CONN_DISABLED || | 1025 | if (params->auto_connect == HCI_AUTO_CONN_DISABLED || |
1019 | params->auto_connect == HCI_AUTO_CONN_REPORT) { | 1026 | params->auto_connect == HCI_AUTO_CONN_REPORT || |
1027 | params->auto_connect == HCI_AUTO_CONN_EXPLICIT) { | ||
1020 | list_del_init(¶ms->action); | 1028 | list_del_init(¶ms->action); |
1021 | list_add(¶ms->action, &hdev->pend_le_conns); | 1029 | list_add(¶ms->action, &hdev->pend_le_conns); |
1022 | } | 1030 | } |