Received: by 2002:a05:6358:700f:b0:131:369:b2a3 with SMTP id 15csp2968807rwo; Thu, 3 Aug 2023 19:11:15 -0700 (PDT) X-Google-Smtp-Source: AGHT+IET1fmy6n41EFEtlW64T4STOiDs7N3gnv1U9U0G0P7cVaLTOmyt/tq+ZtG+RpSz2I7g7ccT X-Received: by 2002:a17:907:78cf:b0:993:d920:87d3 with SMTP id kv15-20020a17090778cf00b00993d92087d3mr302417ejc.25.1691115075165; Thu, 03 Aug 2023 19:11:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691115075; cv=none; d=google.com; s=arc-20160816; b=lEn+Z9caGGw/IMieYHCad7StX2G+LrkONOsBb8sXTHUq+LtIApOVD3YRMDX6Iw3Few 3dNV2agKWFz5ydxavVVypbyuymZNHaiOnNis9uL5swJxdXn7E7JJHFtxFuO7YiXrPGkK OWumiEcbWd1IOjlegemz4YhTO3sC+WIAkevd/o6R5bdTcS6yVIZrkLVXWgjRwcEYU2ea uFZd1aFZ0rBMss1tAba4fEj1OxP91DbMevAlnaPHJtxv8uCMlX5rEZsCHdJet4A7hRhP hg7hpxMJ0Y8p0LvRo65xdr7qRf6Osam1UcVHaUe701L6Gexp5XAXeG51kJjI9mqyhVAL UmSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:to:from :dkim-signature; bh=WIEsPwNQJyDAIqXk9eD9dl8ZlbgEpVSK34aQ6MX/wbs=; fh=V2LL5OuZUBGeSu6TXDWykcThOoazTGUpkln19rrO2KM=; b=TCTOWqtA7+549/wfkW31R/ByU+i1XxUmVG2RXiK/Asg0Qhhqr1NHxs8gIorVP8t4qs CIl3E7ovh7k+ivy4IbswVRyym2uzt2sESrruGZT+DGcZaeVAOFfUDWa4j46TaD5SB8JF RD77rRHTIpGxUFaQCrcsOLShr6YmRA2yaiGtDbC0bqXI1eA/pLIq95QdmNNDPSQgFfqU U9jnZODJOUr9cmNk/FVt4UkVYkN92oWcT7vDnzjs4OJO80hLYRwnkPkrZq+ChghfgqdH TE424y+lrA+39j2eDeS16dqevOldimSpGwp8QdEUj8Jqh32VJBPyNXp3VO7bJQMPrKKg xFPA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HNuuDPMS; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i22-20020a170906851600b00993686e193csi955941ejx.53.2023.08.03.19.10.43; Thu, 03 Aug 2023 19:11:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=HNuuDPMS; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230292AbjHDALa (ORCPT + 99 others); Thu, 3 Aug 2023 20:11:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32852 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232045AbjHDAL3 (ORCPT ); Thu, 3 Aug 2023 20:11:29 -0400 Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D31FE421D for ; Thu, 3 Aug 2023 17:11:26 -0700 (PDT) Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-76af2cb7404so112683985a.0 for ; Thu, 03 Aug 2023 17:11:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1691107885; x=1691712685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=WIEsPwNQJyDAIqXk9eD9dl8ZlbgEpVSK34aQ6MX/wbs=; b=HNuuDPMS1h0wYiephHJDauMEqg3Cb5OaOV336FElUa3oC9zLDcZ9YaPq/cjg2TyPpd uw1aeWvnEEAAwo+64qbOmRVAVp4yOaXxbYFyCSw+baiYbqhb7cWSAuXyGJbAzWoWzMs7 6afrzEqloFZgvExHkkpEnLWX0wc71o4AJIMxSyJdwKgaTKnH/izqrrrtKTut3gGEoWSG DeRvjR2Fsj6wEGlV82IA5RNkuDavKbcUWtti3S8Vqrv7emUB8blXjlgWjiaS+U6fOmEM kouHF4SuQ15NdVAqS5YLJqkl7m7IKQCJVfjDSiLiqwgKvyxfKm+ehgc53jTilMuAesIi /DQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691107885; x=1691712685; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=WIEsPwNQJyDAIqXk9eD9dl8ZlbgEpVSK34aQ6MX/wbs=; b=jhtd3xTd0h8n8DLd0YRxRgAUHHQjl4Q2Yd5FguJPa8A9rl75jLOQa8ujAkS2i0w6Nn mRTJd+6IzlcLHhbgB5qKwQ5yQKkZcX2jpg3n0xR1QCeF6XIQWh3QVOZ+X6DIZkV1Esfn bBUitOjwzIHMLbxbA+DSe4tBx21hcaB8taUHJo5n/uextKpOcCH0rewg0PqyM1Hk80ug j4f5ZwDNP2ZTHFRFZmhGWmyQ2pPNi6pOxfl94JGVkcm3ET53fyQWBtA34vv9xkpUieyW y3S1fff+Kcpmq7YLB7IjW1b1ORYJuuNHHwe/y+TkcizdgfYA+8VPlA1BzHOURQmdtzmo ZI+A== X-Gm-Message-State: AOJu0Yzzlcx2cG8JngpxlFDMSyXWr2Q9hNMuLcLrWvgMoqtKFYmlD6id 6mx5kjkuHVCUpv0cmY1OiPZZvBwFq+k= X-Received: by 2002:a05:6214:18ee:b0:63c:ef88:f8f2 with SMTP id ep14-20020a05621418ee00b0063cef88f8f2mr194515qvb.32.1691107885330; Thu, 03 Aug 2023 17:11:25 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-236-201-58.hsd1.or.comcast.net. [71.236.201.58]) by smtp.gmail.com with ESMTPSA id y11-20020a0ce04b000000b0063c6c7f4b92sm272448qvk.1.2023.08.03.17.11.24 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Aug 2023 17:11:24 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v2 5/5] Bluetooth: hci_conn: Fix not allowing valid CIS ID Date: Thu, 3 Aug 2023 17:11:15 -0700 Message-ID: <20230804001115.907885-5-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230804001115.907885-1-luiz.dentz@gmail.com> References: <20230804001115.907885-1-luiz.dentz@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org From: Luiz Augusto von Dentz 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 --- net/bluetooth/hci_conn.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 13bd2753abbb..84f2ac21a85a 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1849,9 +1849,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, -- 2.41.0