Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp172312rwl; Tue, 11 Apr 2023 16:22:54 -0700 (PDT) X-Google-Smtp-Source: AKy350ZaCL+BC3bhBny4AkFyzQE17viVh4LaB0gpIeKRtDcEKGUFswYc22ansiL7MJjexgY7Sa9B X-Received: by 2002:a05:6a20:b905:b0:de:9f78:f677 with SMTP id fe5-20020a056a20b90500b000de9f78f677mr3896708pzb.23.1681255374094; Tue, 11 Apr 2023 16:22:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681255374; cv=none; d=google.com; s=arc-20160816; b=B/2XpoXPKuDZpANMsBakgHhd1WRf3tK65VGwEPw57+mH25/OYZv2uO7kxlXpvGqDFP GphAKduMEmbwTqnNCT2Nnjd2ys96rxfVGOo3U+3lZLAJr7k0ce8cqito2FTuL5YPUTlZ WcQCdy4ulaGJCsmjbYPsAu4ta1Ll0Icaif9S9ATnFw34yE5ZUhWDfU5HjDkYN4Z9rCGI UJGdH9JEUah6Ory3MjSmAu7U7IE9tFTiKcR3R/QKHpan++qr57SEp1VP+eD8U192wahI 7ZGP40KlcoiW8a1W7huC02+iV8K2yE4ncdALLHis8a2Nn2/FRa/ufm6pu0Jq0dMBZTKv OAUw== 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=JRDmxKqTHJosfSXyI18HF4KI1p4+zVQPXKQNZCvWLmgothvRfJdxhPW1nTIAq/v/2M T8gL/0TBziNMvbVVYmCMG01t2j7QQEOVGc75ZmK3wMdOD2vEbX1WpU3pERD92LjoiU2Q 79G6+poVvo1Fmr1A6Kw4t79qo8PR5AZDJyoiYFPm8h25V3pc5Lel3Ta1qk4hyYI6q1IL M2EgSB+wHjdJNfggouWkf4XiH3H4e4tLM7/Lz5XGlM6U+EbzMtdNVVdQSIj/nl9Wc4qq 1X/xRHFD+r5AaOfASbagPEfQ8tAdGrbHYBpshzyrqmAtGO8NAnoCngJs8Ul5GzQghHS6 EXwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=WepGbX97; 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 c15-20020a63ef4f000000b004fb9330dcfcsi14634591pgk.323.2023.04.11.16.22.24; Tue, 11 Apr 2023 16:22:54 -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=WepGbX97; 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 S229660AbjDKXTh (ORCPT + 99 others); Tue, 11 Apr 2023 19:19:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59198 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229655AbjDKXTf (ORCPT ); Tue, 11 Apr 2023 19:19:35 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3AC130EB for ; Tue, 11 Apr 2023 16:19:30 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id y6so8372670plp.2 for ; Tue, 11 Apr 2023 16:19:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1681255169; 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=WepGbX97QEbFL1Ugw0UI0tK1TkuElQelTGDxqRibhKnRcfRNQ7rjwtkBNx2cUfDWL9 2K23H+3RmVuYEpL2b3Ta3FCXwQtye3wvWsfijBJAUTvuXmW67/k8L5iXSDt4bzoYYeXs DWlzY+iVcPf5uKM6fGxE2iB7yPSIgRvwvimIbuYbRB/39aBY/wVwJ7nXKTJ3giVjh1gj /AZK1g+Jop2XvPw6LA3tb54vR/uwNferjilQRiCFqhQsAf3WqdHbvx5ebSmvIlas7EGi 87/dzY+tID890nTWUJPPwT85tm3Zak9tZuTxAxSXNEHdUdAPdhOclFnEYh2OEeyGXVyE eDsg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681255169; 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=ymdKMCE1/eHHJfFO8R/epGEpn9vF6SVH6AiuzAKjdDG8Hx3Fe4g55mdbBP2WaRZOuv dQsDRq2jyd0jYAA2N3k7W5IIoBlhsdfY3Rv11DmHvWHei1P7bxGMlSUq6z1pG1taqSWw Iz0XPOdrXggwVrkViJKYzgVnKfRhB5AtkH2ytKuxKEE3q7moQfqIE9WUF9NWe9dpg4lz U6eOY6RIw1owGa0auzph+uxprINXFs8Jwq8BIcuVMOVCqMYAoLz/vUeC33MG9oTvLGbc 874vy6h33qViyNqoXCoEh60XX8l6m/Kus8tOgVcaQNR1U9qvxTbiwKX+nDlT5axu7DpH 7OxQ== X-Gm-Message-State: AAQBX9drqG7IAcdk+IhY0CP+yOMr0uXAV4lCyA9YizLhNveOl10lyjMM brG/kZCuKGScqFA3qfjgG5ABI2mtX5Y= X-Received: by 2002:a17:90b:1c06:b0:240:9e3d:d532 with SMTP id oc6-20020a17090b1c0600b002409e3dd532mr6079394pjb.8.1681255169488; Tue, 11 Apr 2023 16:19:29 -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 em3-20020a17090b014300b00246b7b8b43asm112556pjb.49.2023.04.11.16.19.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 16:19:28 -0700 (PDT) From: Luiz Augusto von Dentz To: linux-bluetooth@vger.kernel.org Subject: [RFC 2/2] Bluetooth: hci_conn: Fix not matching by CIS ID Date: Tue, 11 Apr 2023 16:19:25 -0700 Message-Id: <20230411231925.361066-2-luiz.dentz@gmail.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230411231925.361066-1-luiz.dentz@gmail.com> References: <20230411231925.361066-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