]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
Bluetooth: ISO: Match QoS adv handle with BIG handle
authorIulia Tanasescu <iulia.tanasescu@nxp.com>
Tue, 3 Oct 2023 14:37:39 +0000 (17:37 +0300)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Mon, 23 Oct 2023 18:01:53 +0000 (11:01 -0700)
In case the user binds multiple sockets for the same BIG, the BIG
handle should be matched with the associated adv handle, if it has
already been allocated previously.

Signed-off-by: Iulia Tanasescu <iulia.tanasescu@nxp.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
net/bluetooth/hci_conn.c

index e9c56fcd99c43b026b1df2f2cfb5793bb275d8df..974631e652c1ddafe960b35ff2dc7e7804b838f4 100644 (file)
@@ -1494,6 +1494,18 @@ static int qos_set_bis(struct hci_dev *hdev, struct bt_iso_qos *qos)
 
        /* Allocate BIS if not set */
        if (qos->bcast.bis == BT_ISO_QOS_BIS_UNSET) {
+               if (qos->bcast.big != BT_ISO_QOS_BIG_UNSET) {
+                       conn = hci_conn_hash_lookup_big(hdev, qos->bcast.big);
+
+                       if (conn) {
+                               /* If the BIG handle is already matched to an advertising
+                                * handle, do not allocate a new one.
+                                */
+                               qos->bcast.bis = conn->iso_qos.bcast.bis;
+                               return 0;
+                       }
+               }
+
                /* Find an unused adv set to advertise BIS, skip instance 0x00
                 * since it is reserved as general purpose set.
                 */