Connections with type of PA_LINK shall be considered temporary just to
track the lifetime of PA Sync setup, once the BIG Sync is established
and connection are created with BIS_LINK the existing PA_LINK
connection shall not longer use bis_cleanup otherwise it terminates the
PA Sync when that shall be left to BIS_LINK connection to do it.
Fixes: a7bcffc673de ("Bluetooth: Add PA_LINK to distinguish BIG sync and PA sync connections")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
                /* Check if ISO connection is a BIS and terminate advertising
                 * set and BIG if there are no other connections using it.
                 */
-               bis = hci_conn_hash_lookup_big(hdev, conn->iso_qos.bcast.big);
+               bis = hci_conn_hash_lookup_big_state(hdev,
+                                                    conn->iso_qos.bcast.big,
+                                                    BT_CONNECTED,
+                                                    HCI_ROLE_MASTER);
+               if (bis)
+                       return;
+
+               bis = hci_conn_hash_lookup_big_state(hdev,
+                                                    conn->iso_qos.bcast.big,
+                                                    BT_CONNECT,
+                                                    HCI_ROLE_MASTER);
                if (bis)
                        return;
 
 
                                continue;
                }
 
-               if (ev->status != 0x42)
+               if (ev->status != 0x42) {
                        /* Mark PA sync as established */
                        set_bit(HCI_CONN_PA_SYNC, &bis->flags);
+                       /* Reset cleanup callback of PA Sync so it doesn't
+                        * terminate the sync when deleting the connection.
+                        */
+                       conn->cleanup = NULL;
+               }
 
                bis->sync_handle = conn->sync_handle;
                bis->iso_qos.bcast.big = ev->handle;