blob: c683c5aa1db7d6943e668f8de6275956c3761802 [file]
From bd5b00318380ed6e246b8e81e7043e1c2411a7f7 Mon Sep 17 00:00:00 2001
From: Sasha Levin <sashal@kernel.org>
Date: Thu, 3 Aug 2023 14:41:46 -0700
Subject: Bluetooth: ISO: Fix not checking for valid CIG/CIS IDs
From: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
[ Upstream commit b7f923b1ef6a2e76013089d30c9552257056360a ]
Valid range of CIG/CIS are 0x00 to 0xEF, so this checks they are
properly checked before attempting to use HCI_OP_LE_SET_CIG_PARAMS.
Fixes: ccf74f2390d6 ("Bluetooth: Add BTPROTO_ISO socket type")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/bluetooth/iso.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/net/bluetooth/iso.c b/net/bluetooth/iso.c
index dfa45dfb69480..cd07836850758 100644
--- a/net/bluetooth/iso.c
+++ b/net/bluetooth/iso.c
@@ -1216,6 +1216,12 @@ static bool check_io_qos(struct bt_iso_io_qos *qos)
static bool check_ucast_qos(struct bt_iso_qos *qos)
{
+ if (qos->ucast.cig > 0xef && qos->ucast.cig != BT_ISO_QOS_CIG_UNSET)
+ return false;
+
+ if (qos->ucast.cis > 0xef && qos->ucast.cis != BT_ISO_QOS_CIS_UNSET)
+ return false;
+
if (qos->ucast.sca > 0x07)
return false;
--
2.40.1