aboutsummaryrefslogtreecommitdiffstats
path: root/net/bluetooth
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@intel.com>2014-02-28 05:54:15 -0500
committerMarcel Holtmann <marcel@holtmann.org>2014-02-28 10:53:07 -0500
commitb46e00308929cc0317a021a7ac050790f023b1ca (patch)
treeeb6c44570ccff40611b0ffeb09bd3ef986030d24 /net/bluetooth
parent8d97250ea2231736225f2e99a91adb266eedfcbe (diff)
Bluetooth: Fix updating connection state to BT_CONNECT too early
We shouldn't update the hci_conn state to BT_CONNECT until the moment that we're ready to send the initiating HCI command for it. If the connection has the BT_CONNECT state too early the code responsible for updating the local random address may incorrectly think there's a pending connection in progress and refuse to update the address. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Diffstat (limited to 'net/bluetooth')
-rw-r--r--net/bluetooth/hci_conn.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 5b0802994cbb..818330c1b2a2 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -588,6 +588,8 @@ static void hci_req_add_le_create_conn(struct hci_request *req,
588 cp.max_ce_len = __constant_cpu_to_le16(0x0000); 588 cp.max_ce_len = __constant_cpu_to_le16(0x0000);
589 589
590 hci_req_add(req, HCI_OP_LE_CREATE_CONN, sizeof(cp), &cp); 590 hci_req_add(req, HCI_OP_LE_CREATE_CONN, sizeof(cp), &cp);
591
592 conn->state = BT_CONNECT;
591} 593}
592 594
593static void stop_scan_complete(struct hci_dev *hdev, u8 status) 595static void stop_scan_complete(struct hci_dev *hdev, u8 status)
@@ -689,7 +691,6 @@ struct hci_conn *hci_connect_le(struct hci_dev *hdev, bdaddr_t *dst,
689 691
690 conn->dst_type = dst_type; 692 conn->dst_type = dst_type;
691 693
692 conn->state = BT_CONNECT;
693 conn->out = true; 694 conn->out = true;
694 conn->link_mode |= HCI_LM_MASTER; 695 conn->link_mode |= HCI_LM_MASTER;
695 conn->sec_level = BT_SECURITY_LOW; 696 conn->sec_level = BT_SECURITY_LOW;