Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp394549rwb; Thu, 27 Jul 2023 14:38:58 -0700 (PDT) X-Google-Smtp-Source: APBJJlFFwbsjvL0lLzc23voXCD69/vFyC7avtTnpvIjELyBj3TbFqU/kjlN8THZMlFgEvH3ZCYtP X-Received: by 2002:a17:903:11d1:b0:1b0:2658:daf7 with SMTP id q17-20020a17090311d100b001b02658daf7mr531614plh.36.1690493937879; Thu, 27 Jul 2023 14:38:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690493937; cv=none; d=google.com; s=arc-20160816; b=pAlbGNop7hJiNRIWLlWG1plOvg3RuqzEApAWCqEKY5TWEJpPebS4dNnLq2kH+cveXt TRomVNWnVsVqWvY5OUp1SSM1FtDKsMfwfoFPYGh7uhdShOKltc69noK+rwotHUUZW7Lp CnoUSqTHx+lYk90K+OEClaiAPWbra64sSj9P/gCbP/Csiv/BF0/jRcAoEGp95eJxdpEP qs41Q6odMObSAhuNVAlAh2orfG6CJJXGptiIRcl9/TmyaUc0grvbWSmsiEQEuyLqGCFy ptmlGE+avWkkIwiLun/LomM1HjiN7ZYvQM2+XtNHkIl2cKL/e8RupXH++siaVGHQOVKr EmEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3v/h5cCsQrW4ln+fS02QRsQUzam6Cdj4Xv6G23fl90c=; fh=dwH3AZpsHuEksRRnfJiHwkkLNBOgMQ54kYVFEIV8xnc=; b=JhDfNGhI01h/m9RAiT9AIttSs/V+CSr5z/SkJdTSE8V/D7M72IwEbMD6WJRFHODTKZ IQvqDRRPdp/YRg54dBbJApuMZ24SsILzBdmK/zseLM8TvlMvQ1EBsM6OSPxykirwzeKX M9vN7bU8mnKULf861tlisHNNbImn5LBqjL+8Zz5IznjOIJdsEN1PB6Wu+k6lSu5RBbME prK0qJPMjsA0IuqPFNpoavtog5KsNaAXEGQbP/A8H/0p+GwEYNIZHJUfc1W7ojU00hyf +5ICwxNqvX9g0pJL8SoEiLPhEjiqhibMBgVGhrdyHQDBBQIxvINT6y/Bjlx5nKs77EAV zgnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=VLY5vwkX; 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 hg9-20020a17090b300900b002632a1243dbsi3293098pjb.104.2023.07.27.14.38.38; Thu, 27 Jul 2023 14:38:57 -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=VLY5vwkX; 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 S231908AbjG0VY1 (ORCPT + 99 others); Thu, 27 Jul 2023 17:24:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232146AbjG0VYR (ORCPT ); Thu, 27 Jul 2023 17:24:17 -0400 Received: from mail-lj1-x22b.google.com (mail-lj1-x22b.google.com [IPv6:2a00:1450:4864:20::22b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0A5BE1B8 for ; Thu, 27 Jul 2023 14:23:52 -0700 (PDT) Received: by mail-lj1-x22b.google.com with SMTP id 38308e7fff4ca-2b97f34239cso21369681fa.3 for ; Thu, 27 Jul 2023 14:23:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1690493022; x=1691097822; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=3v/h5cCsQrW4ln+fS02QRsQUzam6Cdj4Xv6G23fl90c=; b=VLY5vwkX6Vx4h1L/IevhWw9T352QfvprylCpICLBviLzNJsz9Y5pUeyJVYbvLzLYg/ yYUqCdC3SIsyd03tEOh0x+xNCW4iCY4ed41h1E/vOayTaK/bUiTpYswPUJm6ZO+PetLO WLf73SVAPBN4TTHBOj4T+Gi3Ia9XRwvBbrKhhWsnLlsGO9IPc1NBR55HtBTWb2JqRRK8 u+fCLHoEdig25rD8ik6KyymhpeB+T3wTVjfVItt97OGOoOIAunwRDvygrMmDb1NHiiHa TjueUlI8VjlnXly0QR2vUR60I1lI2aV7xo8Nd9dyRINFegUgjXoB913Q6jwrXoAP7Ddk q7bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690493022; x=1691097822; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=3v/h5cCsQrW4ln+fS02QRsQUzam6Cdj4Xv6G23fl90c=; b=kLZxlL7JVcHCud2I7FiuntKkeoKRBR+BtT/n4+IN0v4HbCUSBEiWgA56Q2AUeGFJYm 8HAxI2+mAzXmLC+Bm77KTtkhTlHOS87KJxt8EUfVy94b9r4h5RDSVatQrlWWkznJ2pxe PNMvAcMg7WMmifTkR4zsv6RFjsMJnGdKcpV+u3hya85opS3UXX3EumOZrP9R7kjTlQbK KdICFHesd+g4PdspyGn6JuqVngi/Qx21ScBLgjulTdR/oPvsTc1fA/nxkiMh3Vv+Shfh kl7IEDE52hl7OfTts1JTVv+H7OVWs3VejkYDk/SmC5f3urZzRCMRW2x0szboDQKLzCm9 QTmA== X-Gm-Message-State: ABy/qLYj2mCbvtibrWLUKVRYGekLi0Btb4630GyLvUa+UC7l/MimK69L YijgTgM9MOxCc3UyLRMdqabaQyeilwxAYWUTXzmBLQWrcWg= X-Received: by 2002:a2e:7013:0:b0:2b9:5b46:2107 with SMTP id l19-20020a2e7013000000b002b95b462107mr198648ljc.9.1690493021517; Thu, 27 Jul 2023 14:23:41 -0700 (PDT) MIME-Version: 1.0 References: <6d9672c9a1e97b87e823e05ff07576013683979d.1690399379.git.pav@iki.fi> In-Reply-To: <6d9672c9a1e97b87e823e05ff07576013683979d.1690399379.git.pav@iki.fi> From: Luiz Augusto von Dentz Date: Thu, 27 Jul 2023 14:23:29 -0700 Message-ID: Subject: Re: [PATCH RFC 5/6] Bluetooth: hci_sync: delete CIS in BT_OPEN/CONNECT/BOUND when aborting To: Pauli Virtanen Cc: linux-bluetooth@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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,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 Hi Pauli, On Wed, Jul 26, 2023 at 2:43=E2=80=AFPM Pauli Virtanen wrote: > > Dropped CIS that are in state BT_OPEN/BT_BOUND, and in state BT_CONNECT > with HCI_CONN_CREATE_CIS unset, should be cleaned up immediately. > Closing CIS ISO sockets should result to the hci_conn be deleted, so > that potentially pending CIG removal can run. > > hci_abort_conn cannot refer to them by handle, since their handle is > still unset if Set CIG Parameters has not yet completed. > > This fixes CIS not being terminated if the socket is shut down > immediately after connection, so that the hci_abort_conn runs before Set > CIG Parameters completes. See new BlueZ test "ISO Connect Close - Success= " > > Signed-off-by: Pauli Virtanen > --- > net/bluetooth/hci_sync.c | 16 ++++++++++++++-- > 1 file changed, 14 insertions(+), 2 deletions(-) > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > index 101548fe81da..3926213c29e6 100644 > --- a/net/bluetooth/hci_sync.c > +++ b/net/bluetooth/hci_sync.c > @@ -5339,6 +5339,10 @@ static int hci_connect_cancel_sync(struct hci_dev = *hdev, struct hci_conn *conn, > if (test_bit(HCI_CONN_CREATE_CIS, &conn->flags)) > return hci_disconnect_sync(hdev, conn, reason); > > + /* CIS with no Create CIS sent have nothing to cancel */ > + if (bacmp(&conn->dst, BDADDR_ANY)) > + return HCI_ERROR_LOCAL_HOST_TERM; > + > /* There is no way to cancel a BIS without terminating th= e BIG > * which is done later on connection cleanup. > */ > @@ -5426,9 +5430,17 @@ int hci_abort_conn_sync(struct hci_dev *hdev, stru= ct hci_conn *conn, u8 reason) > case BT_CONNECT2: > return hci_reject_conn_sync(hdev, conn, reason); > case BT_OPEN: > - /* Cleanup bises that failed to be established */ > - if (test_and_clear_bit(HCI_CONN_BIG_SYNC_FAILED, &conn->f= lags)) > + /* Cleanup failed CIS, and BIS that failed to be establis= hed */ > + if (bacmp(&conn->dst, BDADDR_ANY) || > + test_and_clear_bit(HCI_CONN_BIG_SYNC_FAILED, &conn->f= lags)) bacmp(&conn->dst, BDADDR_ANY) will match connections other than ISO_LINK as well so I wonder if this is intentional? If it is then we need to update the commands to reflect that we are going to call hci_conn_failed, it seems we didn't call it before but perhaps this is a side effect of the other changes. > + hci_conn_failed(conn, reason); > + break; > + case BT_BOUND: > + /* Bound CIS should be cleaned up */ > + if (conn->type =3D=3D ISO_LINK && bacmp(&conn->dst, BDADD= R_ANY)) > hci_conn_failed(conn, reason); > + else > + conn->state =3D BT_CLOSED; > break; > default: > conn->state =3D BT_CLOSED; > -- > 2.41.0 > --=20 Luiz Augusto von Dentz