diff options
Diffstat (limited to 'net/bluetooth')
-rw-r--r-- | net/bluetooth/hci_event.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index ac86b656c7a8..47656beee14c 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -3306,6 +3306,19 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3306 | 3306 | ||
3307 | hci_dev_lock(hdev); | 3307 | hci_dev_lock(hdev); |
3308 | 3308 | ||
3309 | if (ev->status) { | ||
3310 | conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); | ||
3311 | if (!conn) | ||
3312 | goto unlock; | ||
3313 | |||
3314 | mgmt_connect_failed(hdev, &conn->dst, conn->type, | ||
3315 | conn->dst_type, ev->status); | ||
3316 | hci_proto_connect_cfm(conn, ev->status); | ||
3317 | conn->state = BT_CLOSED; | ||
3318 | hci_conn_del(conn); | ||
3319 | goto unlock; | ||
3320 | } | ||
3321 | |||
3309 | conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &ev->bdaddr); | 3322 | conn = hci_conn_hash_lookup_ba(hdev, LE_LINK, &ev->bdaddr); |
3310 | if (!conn) { | 3323 | if (!conn) { |
3311 | conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr); | 3324 | conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr); |
@@ -3318,15 +3331,6 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3318 | conn->dst_type = ev->bdaddr_type; | 3331 | conn->dst_type = ev->bdaddr_type; |
3319 | } | 3332 | } |
3320 | 3333 | ||
3321 | if (ev->status) { | ||
3322 | mgmt_connect_failed(hdev, &ev->bdaddr, conn->type, | ||
3323 | conn->dst_type, ev->status); | ||
3324 | hci_proto_connect_cfm(conn, ev->status); | ||
3325 | conn->state = BT_CLOSED; | ||
3326 | hci_conn_del(conn); | ||
3327 | goto unlock; | ||
3328 | } | ||
3329 | |||
3330 | if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) | 3334 | if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) |
3331 | mgmt_device_connected(hdev, &ev->bdaddr, conn->type, | 3335 | mgmt_device_connected(hdev, &ev->bdaddr, conn->type, |
3332 | conn->dst_type, 0, NULL, 0, NULL); | 3336 | conn->dst_type, 0, NULL, 0, NULL); |