From e5b292cdfcc710091131af9ad7e7321d2e16f5ec Mon Sep 17 00:00:00 2001 From: David Marlin Date: Fri, 22 Mar 2024 13:59:42 -0500 Subject: [PATCH] Bluetooth: ISO: Match QoS adv handle with BIG handle JIRA: https://issues.redhat.com/browse/RHEL-30099 commit 71b7bb48b9837ca97c75a521cc68398641dcb1d6 Author: Iulia Tanasescu Date: Tue Oct 3 17:37:39 2023 +0300 Bluetooth: ISO: Match QoS adv handle with BIG handle 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 Signed-off-by: Luiz Augusto von Dentz Signed-off-by: David Marlin --- net/bluetooth/hci_conn.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 0465d8c73ae0..d01db89fcb46 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1521,6 +1521,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. */