Bluetooth: Fix incorrect branch in connection complete
authorAbhishek Pandit-Subedi <abhishekpandit@chromium.org>
Fri, 20 Mar 2020 00:07:13 +0000 (17:07 -0700)
committerMarcel Holtmann <marcel@holtmann.org>
Mon, 23 Mar 2020 17:48:50 +0000 (18:48 +0100)
When handling auto-connected devices, we should execute the rest of the
connection complete when it was previously discovered and it is an ACL
connection.

Signed-off-by: Abhishek Pandit-Subedi <abhishekpandit@chromium.org>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_event.c

index 20408d3862683cee337280dca1cd952a39b9c3c5..cd3d7d90029b19237f8e307a40fe774a5dcd1ec6 100644 (file)
@@ -2539,16 +2539,17 @@ static void hci_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
                                bt_dev_err(hdev, "no memory for new conn");
                                goto unlock;
                        }
-               }
-
-               if (ev->link_type != SCO_LINK)
-                       goto unlock;
+               } else {
+                       if (ev->link_type != SCO_LINK)
+                               goto unlock;
 
-               conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK, &ev->bdaddr);
-               if (!conn)
-                       goto unlock;
+                       conn = hci_conn_hash_lookup_ba(hdev, ESCO_LINK,
+                                                      &ev->bdaddr);
+                       if (!conn)
+                               goto unlock;
 
-               conn->type = SCO_LINK;
+                       conn->type = SCO_LINK;
+               }
        }
 
        if (!ev->status) {