diff options
-rw-r--r-- | net/bluetooth/hci_event.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c index 92522b470f6b..32e21ad36a68 100644 --- a/net/bluetooth/hci_event.c +++ b/net/bluetooth/hci_event.c | |||
@@ -3334,19 +3334,6 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3334 | hci_dev_lock(hdev); | 3334 | hci_dev_lock(hdev); |
3335 | 3335 | ||
3336 | conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); | 3336 | conn = hci_conn_hash_lookup_state(hdev, LE_LINK, BT_CONNECT); |
3337 | |||
3338 | if (ev->status) { | ||
3339 | if (!conn) | ||
3340 | goto unlock; | ||
3341 | |||
3342 | mgmt_connect_failed(hdev, &conn->dst, conn->type, | ||
3343 | conn->dst_type, ev->status); | ||
3344 | hci_proto_connect_cfm(conn, ev->status); | ||
3345 | conn->state = BT_CLOSED; | ||
3346 | hci_conn_del(conn); | ||
3347 | goto unlock; | ||
3348 | } | ||
3349 | |||
3350 | if (!conn) { | 3337 | if (!conn) { |
3351 | conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr); | 3338 | conn = hci_conn_add(hdev, LE_LINK, &ev->bdaddr); |
3352 | if (!conn) { | 3339 | if (!conn) { |
@@ -3362,6 +3349,15 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb) | |||
3362 | } | 3349 | } |
3363 | } | 3350 | } |
3364 | 3351 | ||
3352 | if (ev->status) { | ||
3353 | mgmt_connect_failed(hdev, &conn->dst, conn->type, | ||
3354 | conn->dst_type, ev->status); | ||
3355 | hci_proto_connect_cfm(conn, ev->status); | ||
3356 | conn->state = BT_CLOSED; | ||
3357 | hci_conn_del(conn); | ||
3358 | goto unlock; | ||
3359 | } | ||
3360 | |||
3365 | if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) | 3361 | if (!test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags)) |
3366 | mgmt_device_connected(hdev, &ev->bdaddr, conn->type, | 3362 | mgmt_device_connected(hdev, &ev->bdaddr, conn->type, |
3367 | conn->dst_type, 0, NULL, 0, NULL); | 3363 | conn->dst_type, 0, NULL, 0, NULL); |