]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: hci_conn: Fix not allowing valid CIS ID
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Thu, 3 Aug 2023 23:41:34 +0000 (16:41 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Sep 2023 07:48:04 +0000 (09:48 +0200)
[ Upstream commit f2f84a70f9d0c9a3263194ca9d82e7bc6027d356 ]

Only the number of CIS shall be limited to 0x1f, the CIS ID in the
other hand is up to 0xef.

Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/bluetooth/hci_conn.c

index d481a1d2c0a28936f2ae01aba53e473c8b33584e..ee9d6ff75246f59c0eb09ce503131bbf0575dfbc 100644 (file)
@@ -1862,9 +1862,12 @@ static bool hci_le_set_cig_params(struct hci_conn *conn, struct bt_iso_qos *qos)
                cis_add(&data, qos);
        }
 
-       /* Reprogram all CIS(s) with the same CIG */
-       for (data.cig = qos->ucast.cig, data.cis = 0x00; data.cis < 0x11;
-            data.cis++) {
+       /* Reprogram all CIS(s) with the same CIG, valid range are:
+        * num_cis: 0x00 to 0x1F
+        * cis_id: 0x00 to 0xEF
+        */
+       for (data.cig = qos->ucast.cig, data.cis = 0x00; data.cis < 0xf0 &&
+            data.pdu.cp.num_cis < ARRAY_SIZE(data.pdu.cis); data.cis++) {
                data.count = 0;
 
                hci_conn_hash_list_state(hdev, cis_list, ISO_LINK, BT_BOUND,