Skip to content

Commit ac1a7c3

Browse files
Vudentzgregkh
authored andcommitted
Bluetooth: hci_conn: Fix not matching by CIS ID
[ Upstream commit c14516f ] 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 <luiz.von.dentz@intel.com> Stable-dep-of: 0acd4ee ("Bluetooth: hci_event: validate LE Set CIG Parameters response") Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent bb5f541 commit ac1a7c3

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

include/net/bluetooth/hci_core.h

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

11791179
static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev,
11801180
bdaddr_t *ba,
1181-
__u8 ba_type)
1181+
__u8 ba_type,
1182+
__u8 cig,
1183+
__u8 id)
11821184
{
11831185
struct hci_conn_hash *h = &hdev->conn_hash;
11841186
struct hci_conn *c;
@@ -1189,6 +1191,14 @@ static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev,
11891191
if (c->type != ISO_LINK)
11901192
continue;
11911193

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

net/bluetooth/hci_conn.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1862,7 +1862,8 @@ struct hci_conn *hci_bind_cis(struct hci_dev *hdev, bdaddr_t *dst,
18621862
{
18631863
struct hci_conn *cis;
18641864

1865-
cis = hci_conn_hash_lookup_cis(hdev, dst, dst_type);
1865+
cis = hci_conn_hash_lookup_cis(hdev, dst, dst_type, qos->ucast.cig,
1866+
qos->ucast.cis);
18661867
if (!cis) {
18671868
cis = hci_conn_add_unset(hdev, ISO_LINK, dst, HCI_ROLE_MASTER);
18681869
if (!cis)

0 commit comments

Comments
 (0)