Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1714738rwl; Wed, 12 Apr 2023 17:52:00 -0700 (PDT) X-Google-Smtp-Source: AKy350Ydd3gKhUM3MoSRMmiGuz1ei4C/YifykfP1Y0Td2qsVSA8EObv44j5mdgTprsMEdhGoXKOI X-Received: by 2002:a17:902:da8a:b0:1a6:7510:3341 with SMTP id j10-20020a170902da8a00b001a675103341mr101840plx.69.1681347120074; Wed, 12 Apr 2023 17:52:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681347120; cv=none; d=google.com; s=arc-20160816; b=BW1GILakjx/RRvkUU9zm4eSntjFyDlE2yhUgRh/kPlOO8dsBUhGIJ/DIq7M+N6xqz9 8V+860nFDbS3zBvt+tbPVTmoVz8tG9yac3aaXm+P0z+Dio3lqXBc6Hq4kqbwrjDcN7XE 6jYZJ6jcK/ynbVaAp9D+Seyel+rTuuF8ecVfXKXYpsCNGzhMRC6qtpvCylKEM0qirL/T simWCHQK8Ib18jPc9XceV97A+x3iTiV0ndVzyDNCh0jb8QCk3dTOIFiQOEWxVqyF+zkk R2H5xH0/vaIfUttcg6GQ/i+I46KP3DqafLGeYzFNQi4IEk8jk3uMCHKM3WanCz97AyPl GAgg== 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=hWZGyUIe8vDHexeKos2oNQ+poJ0+KHtIaTu1usVgnDI=; b=UYeCfRKHHzH4n/KFvsOw0o3Bq9rrph2VWj6pEo6K/rz7LKB7Gdl+0QzQt1Sb8LnFga x4+EjoPNEiYBY8WNx2aukvQFd1fV+EyqwqlXCJPpbz8iEfbmCacd4bEpLSgzXo2xJBL8 6MtkKyfixg6K/qGdWcQg+teyJ/B4zh3Fi1xDayziRw0WWbz6RuinhsEMcv3lkWCYDb35 IPJZ2fcwxkekrpc8lhA3Hmbtr+ttxSYbd5BQM/mvsBgI8mr8IAKuN9XZ6/byKs/DSFPP gz6j66ECHkzo6xnyPUnS1Mqq9zqjrwnfhZ5l58CeQ5uN/WBNQK1Yn8xGNm9vdGim0i2L Y/Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=TZbCV4gK; 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 co16-20020a17090afe9000b002469c3f344asi3205112pjb.93.2023.04.12.17.51.38; Wed, 12 Apr 2023 17:52:00 -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=TZbCV4gK; 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 S229451AbjDMAuy (ORCPT + 99 others); Wed, 12 Apr 2023 20:50:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48038 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229647AbjDMAux (ORCPT ); Wed, 12 Apr 2023 20:50:53 -0400 Received: from mail-io1-xd29.google.com (mail-io1-xd29.google.com [IPv6:2607:f8b0:4864:20::d29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8E6B62717 for ; Wed, 12 Apr 2023 17:50:52 -0700 (PDT) Received: by mail-io1-xd29.google.com with SMTP id g16so14751227iom.11 for ; Wed, 12 Apr 2023 17:50:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681347051; 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=hWZGyUIe8vDHexeKos2oNQ+poJ0+KHtIaTu1usVgnDI=; b=TZbCV4gKcHVXGO/KChtbomLXpjZn8qwZxeTC7y5hi/YLQIsgai75UdRk94RV4/syOD M85ZDDOHG+MyDip2z/uNt3HzXPs1uHXPKUtJgG2m6IYlKHCxWEN/c+8FoWXLf48RFjl2 LEeutcGsr+P12xriQTxCMPOHW2RWmO/znVlLhHOWHVCtEOdArf5ECbCEow8rIQaPF8sl TnUdQqpqrrV3daKIa1YtRcdFgPCVkPQj1iOo9Qxwgrr15lipdvS0SYmrtDEAJjk6r6F8 o5mYY4IAsjoKDxtJOEekJ+B3KXDPZ9tQ1fiTAODH1rY7qGXqcAGEghIHQfN2fkA1nJc8 2FmA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681347051; 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=hWZGyUIe8vDHexeKos2oNQ+poJ0+KHtIaTu1usVgnDI=; b=Mf8D9nZKQnxtlBqX9bSEuFYlTxRlHP24a2LsPWeUw/wrbk4Ad7g0D0zI2j0RG2RkFM wX9TbcLJcmNOykKEbCRu1galF2qg3WmBVB1PtAcgTga/RfmmIOhWa/j4EoBkp/l4aUo3 OHhqyCpanoGgfN9RiXye+pglVzaiHgGp2rj1ArXtQH8oGuv1MpkNl5WYAhLrj6LcyITO DpSrC8qsRrsrBQyaiYzeLt3lb3sb5wFspUEDhSjPLmIMHYTN6JtpW0Bjl/IeluRXYNyR zmtGJGBuo463r0PB6tPmkjXA9ceIfVyMwkOzMSoslG2UQCRPNsNjGhhXn9/noLTr2WWU K4uA== X-Gm-Message-State: AAQBX9dN/QTZhNMg4d5rv8Si15Cg0uRegLjbZDDlYHiCa+XmcZuEMYPv LcijP57hwDo2Ca2iuNd8fkQ6LOZjvte/KQ== X-Received: by 2002:a6b:d918:0:b0:751:e48c:7eed with SMTP id r24-20020a6bd918000000b00751e48c7eedmr33938ioc.11.1681347051149; Wed, 12 Apr 2023 17:50:51 -0700 (PDT) Received: from lvondent-mobl4.. (c-71-59-129-171.hsd1.or.comcast.net. [71.59.129.171]) by smtp.gmail.com with ESMTPSA id r14-20020a6bd90e000000b00758facb11fdsm141717ioc.17.2023.04.12.17.50.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Apr 2023 17:50:50 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [PATCH v1 2/3] Bluetooth: hci_conn: Fix not matching by CIS ID Date: Wed, 12 Apr 2023 17:50:45 -0700 Message-Id: <20230413005046.642682-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230413005046.642682-1-luiz.dentz@gmail.com> References: <20230413005046.642682-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_NONE,SPF_HELO_NONE,SPF_PASS 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 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 --- include/net/bluetooth/hci_core.h | 7 ++++++- net/bluetooth/hci_conn.c | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h index 4fe1e71cb9d8..6f5e8594ff2d 100644 --- a/include/net/bluetooth/hci_core.h +++ b/include/net/bluetooth/hci_core.h @@ -1180,7 +1180,8 @@ static inline struct hci_conn *hci_conn_hash_lookup_le(struct hci_dev *hdev, static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev, bdaddr_t *ba, - __u8 ba_type) + __u8 ba_type, + __u8 id) { struct hci_conn_hash *h = &hdev->conn_hash; struct hci_conn *c; @@ -1191,6 +1192,10 @@ static inline struct hci_conn *hci_conn_hash_lookup_cis(struct hci_dev *hdev, if (c->type != ISO_LINK) continue; + /* Match CIS ID if set */ + if (id != BT_ISO_QOS_CIS_UNSET && id != c->iso_qos.ucast.cis) + continue; + if (ba_type == c->dst_type && !bacmp(&c->dst, ba)) { rcu_read_unlock(); return c; diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 8b8ebd3e2585..5524f08b91ae 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -1842,7 +1842,7 @@ struct hci_conn *hci_bind_cis(struct hci_dev *hdev, bdaddr_t *dst, { struct hci_conn *cis; - cis = hci_conn_hash_lookup_cis(hdev, dst, dst_type); + cis = hci_conn_hash_lookup_cis(hdev, dst, dst_type, qos->ucast.cis); if (!cis) { cis = hci_conn_add(hdev, ISO_LINK, dst, HCI_ROLE_MASTER); if (!cis) -- 2.39.2