Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp2230923rwd; Sun, 28 May 2023 10:48:23 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6HfOariTqyLJ95tZWuJE7VPbZf/3Oj31Xlj+E0Tgz85QKWgISzX6GKn16P5b9lEeOFSa17 X-Received: by 2002:a05:6a00:2e0f:b0:643:53b6:d841 with SMTP id fc15-20020a056a002e0f00b0064353b6d841mr13568831pfb.2.1685296102970; Sun, 28 May 2023 10:48:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685296102; cv=none; d=google.com; s=arc-20160816; b=B0rC017proCJhZBWvQ4ABgD7K47j4utRzhvq1FYPjd0UHV91gqUXeDE5/7R3BKkIsM r0YVlp7MQlKhBvWfLBvgFTuYlFqPpG5OZ2yco4kOmlY/hdCKa6oBPGqel60A5CW0Xi9c 0uoeRuh2XBPhC9vO14TxnDeQ5YojP9ZwtUUMmJ1HdPBxwpI+e44vHUqr6EWmk9Eck3iS Ro7QDhLSptWMyBP2JlWlF+e7JVzcvMNHfXPzbwqmcyxwPrzsW/NcWNyEXG/bITXQvlof RSfBFuG68y7lmatGSVQos0f2HVNLpEDXfPSCq8zGM6Ogm0w4RFGOF26jN8rsteQ4F2Ce jlbw== 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:cc:to:from; bh=aHleIWGHVRE9z55isTeh4SSCd7h5Qe8C+nKDfNoto7Q=; b=c/gTXQv5RxoGNbTS4sp89eQVKqWPpdcQGK8GvIKdk8EckzMJuTXZ1ZHMdxeNgrnL5n zLxTmkGqnIND1LNnxrcmXjU2FRlG5rKk4GanXqAFbTY+tkt4vKb/FHcW6WfaEr8/GpNv y/PWbnFAqZBB4BATTIHugpefKO6LMiPVIyz3T52qoAagCk/9tK6FZ7ssZTTT8fvTf7Uh 1VCQ+IVndq4Rfs4lgvsEeDx1p99ql+jIh07MKEHl9bqI+daLQC6NKXLxgTQ/WYhc7p6X YB274mjoZsKfjwWaNKiI5VmUsO1v6Hy8nJf50EMsddM21seMPPTVZLHChM+5/itG2pCZ OR1w== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k123-20020a628481000000b0064d675fc97csi8493763pfd.27.2023.05.28.10.48.09; Sun, 28 May 2023 10:48:22 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbjE1RoX (ORCPT + 99 others); Sun, 28 May 2023 13:44:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229557AbjE1RoU (ORCPT ); Sun, 28 May 2023 13:44:20 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5378FB9 for ; Sun, 28 May 2023 10:44:19 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id DEBDC240101 for ; Sun, 28 May 2023 19:44:17 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QTmHj3fZWz6trs; Sun, 28 May 2023 19:44:17 +0200 (CEST) From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Cc: Pauli Virtanen Subject: [PATCH 4/6] Bluetooth: ISO: don't try to remove CIG if there are bound CIS left Date: Sun, 28 May 2023 17:44:12 +0000 Message-Id: <8a63cb0a2fbbcc365a7384b45dc20e16f666c120.1685294131.git.pav@iki.fi> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.4 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_NEUTRAL,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 Consider existing BOUND & CONNECT state CIS to block CIG removal. Otherwise, under suitable timing conditions we may attempt to remove CIG while Create CIS is pending, which fails. Fixes: 26afbd826ee3 ("Bluetooth: Add initial implementation of CIS connections") Signed-off-by: Pauli Virtanen --- net/bluetooth/hci_conn.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c index 47a8ec796d97..e8a4f2825201 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -974,6 +974,8 @@ static void cis_cleanup(struct hci_conn *conn) /* Check if ISO connection is a CIS and remove CIG if there are * no other connections using it. */ + hci_conn_hash_list_state(hdev, find_cis, ISO_LINK, BT_BOUND, &d); + hci_conn_hash_list_state(hdev, find_cis, ISO_LINK, BT_CONNECT, &d); hci_conn_hash_list_state(hdev, find_cis, ISO_LINK, BT_CONNECTED, &d); if (d.count) return; -- 2.40.1