summaryrefslogtreecommitdiff
path: root/emulator
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-07-07 17:23:53 -0700
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2022-07-11 09:34:45 -0700
commit163de8e231e6e138ebfea710df8211f22d4b9b4e (patch)
tree1a2a05f5777ff6f2997d960ae0e73d16dba38227 /emulator
parente681fae6bcceb73ebab16e6f8c4eabd6265dd40f (diff)
downloadbluez-163de8e231e6e138ebfea710df8211f22d4b9b4e.tar.gz
btdev: Fix not checking if a CIG has any active CIS
Bluetooth Core specification says the CIG must be in configurable state in order to accept the SetCIGParameters: BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E page 2553: 'If the Host issues this command when the CIG is not in the configurable state, the Controller shall return the error code Command Disallowed (0x0C).'
Diffstat (limited to 'emulator')
-rw-r--r--emulator/btdev.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/emulator/btdev.c b/emulator/btdev.c
index 641e308b3..3fdfb64a9 100644
--- a/emulator/btdev.c
+++ b/emulator/btdev.c
@@ -5831,8 +5831,25 @@ static int cmd_set_cig_params(struct btdev *dev, const void *data,
rsp.params.cig_id = cmd->cig_id;
for (i = 0; i < cmd->num_cis; i++) {
+ struct btdev_conn *iso;
+
rsp.params.num_handles++;
rsp.handle[i] = cpu_to_le16(ISO_HANDLE + i);
+
+ /* BLUETOOTH CORE SPECIFICATION Version 5.3 | Vol 4, Part E
+ * page 2553
+ *
+ * If the Host issues this command when the CIG is not in the
+ * configurable state, the Controller shall return the error
+ * code Command Disallowed (0x0C).
+ */
+ iso = queue_find(dev->conns, match_handle,
+ UINT_TO_PTR(cpu_to_le16(rsp.handle[i])));
+ if (iso) {
+ rsp.params.status = BT_HCI_ERR_INVALID_PARAMETERS;
+ i = 0;
+ goto done;
+ }
}
done: