Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1449512rwd; Wed, 31 May 2023 14:15:25 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4Ny49A54J/57KhCl4hzz7CQr/YbVFFUxFmKh53Un0v/+38Zu5STYo4SjlNuVQ54BmqS4fl X-Received: by 2002:a05:6a20:734c:b0:10c:2c30:4765 with SMTP id v12-20020a056a20734c00b0010c2c304765mr7888129pzc.1.1685567724821; Wed, 31 May 2023 14:15:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685567724; cv=none; d=google.com; s=arc-20160816; b=RTo8p2r4hgqUzqyTmePYxWvFRQ100/Eh6sHidKqWTa5Ryq9IXDRDeWw/UWnsBlLj2v bOGRCwS4pDe5sJ3Lwe9777giflUQT5nsn4lwW0p+OBXHwoQSvSPZyvN76fUcQy3/K1iB cV4vX1rSjiTub3nJ8gcR52d+m151mJ0g4UJs8iI0Sn1+PvOhnCNHvpm1xkO9hi+rz7UC WoWpL0xU5qpOfKQrpEPClXWPQbcMwAy+0xQoIcbwW08/DP5uFnNsFFZDHrZO4NDGUBXY XqV/VKWy3jy8IhKXXv5UW32dmxSk1MZvGF5kM03hw15e46veqCxvtfMLm6Bm5xUP14xc 74Aw== 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=In2GQ4RChsfsVcMNhxL0tw8WmzJykrxvybWLaHSpMYc=; b=f0pgYDei5ADwIJ/wLoyKcIDdRmFl+tPh/YKjb6kZFXEj16sUp0ch1OgUl7bTI5Qwcs IlFHUuFA+oRqVsDD658gArchNMMjiG0LNcTb5o9bRmeorRqHx8UaVDJyeTbHWMQE9/gc 5psZaAd9li6ptcba63WiugrefmBYuDd35L29h3lEVHXepsVlmC0fioGVbRC89biWhHgQ VOIKQX88yZtTRjndwJ3SOs2e+ydVCNsp6xJhQkELWSkncF2gP3/UMTFWCAAfu7Wf1jfU leosCQV+s2wcR79xv6miNnnngChEnOf62z15+T4SwkOJE0uJSk4RvDwRYBUKECU+cyZA 4BJg== 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 a21-20020a63e855000000b0053fb78a9abesi1752512pgk.411.2023.05.31.14.15.08; Wed, 31 May 2023 14:15:24 -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 S229748AbjEaVIB (ORCPT + 99 others); Wed, 31 May 2023 17:08:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229473AbjEaVIA (ORCPT ); Wed, 31 May 2023 17:08:00 -0400 Received: from mout02.posteo.de (mout02.posteo.de [185.67.36.142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A570D129 for ; Wed, 31 May 2023 14:07:56 -0700 (PDT) Received: from submission (posteo.de [185.67.36.169]) by mout02.posteo.de (Postfix) with ESMTPS id 3AB1C240106 for ; Wed, 31 May 2023 23:07:54 +0200 (CEST) Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4QWhgF5JYxz9rxW; Wed, 31 May 2023 23:07:53 +0200 (CEST) From: Pauli Virtanen To: linux-bluetooth@vger.kernel.org Cc: Pauli Virtanen Subject: [PATCH v2 2/4] Bluetooth: ISO: don't try to remove CIG if there are bound CIS left Date: Wed, 31 May 2023 21:07:47 +0000 Message-Id: <137e16ab38ea84a02241385e6622497de52ce9a3.1685565568.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 --- Notes: v2: no changes 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 f45476deca82..15cba23ade52 100644 --- a/net/bluetooth/hci_conn.c +++ b/net/bluetooth/hci_conn.c @@ -983,6 +983,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