Skip to content

Commit c14516f

Browse files
committed
Bluetooth: hci_conn: Fix not matching by CIS ID
This fixes only matching CIS by address which prevents creating new hcon if upper layer is requesting a specific CIS ID. Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 0614974 commit c14516f

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

include/net/bluetooth/hci_core.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1180,7 +1180,9 @@ static inline struct hci_conn *hci_conn_hash_lookup_le(struct hci_dev *hdev,
11801180

11811181
static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev,
11821182
bdaddr_t *ba,
1183-
__u8 ba_type)
1183+
__u8 ba_type,
1184+
__u8 cig,
1185+
__u8 id)
11841186
{
11851187
struct hci_conn_hash *h = &hdev->conn_hash;
11861188
struct hci_conn *c;
@@ -1191,6 +1193,14 @@ static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev,
11911193
if (c->type != ISO_LINK)
11921194
continue;
11931195

1196+
/* Match CIG ID if set */
1197+
if (cig != BT_ISO_QOS_CIG_UNSET && cig != c->iso_qos.ucast.cig)
1198+
continue;
1199+
1200+
/* Match CIS ID if set */
1201+
if (id != BT_ISO_QOS_CIS_UNSET && id != c->iso_qos.ucast.cis)
1202+
continue;
1203+
11941204
if (ba_type == c->dst_type && !bacmp(&c->dst, ba)) {
11951205
rcu_read_unlock();
11961206
return c;

net/bluetooth/hci_conn.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1841,7 +1841,8 @@ struct hci_conn *hci_bind_cis(struct hci_dev *hdev, bdaddr_t *dst,
18411841
{
18421842
struct hci_conn *cis;
18431843

1844-
cis = hci_conn_hash_lookup_cis(hdev, dst, dst_type);
1844+
cis = hci_conn_hash_lookup_cis(hdev, dst, dst_type, qos->ucast.cig,
1845+
qos->ucast.cis);
18451846
if (!cis) {
18461847
cis = hci_conn_add(hdev, ISO_LINK, dst, HCI_ROLE_MASTER);
18471848
if (!cis)

0 commit comments

Comments
 (0)