Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp336919ioo; Sat, 21 May 2022 00:22:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxY4/0sMJPXlBeAVzDONSjTkumP4N6fInEcLHUSYsvrrEBn+lKa4fRTwSvjzDmxY5/rkGxt X-Received: by 2002:a63:5a01:0:b0:3d8:22cb:9224 with SMTP id o1-20020a635a01000000b003d822cb9224mr11640224pgb.548.1653117772343; Sat, 21 May 2022 00:22:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653117772; cv=none; d=google.com; s=arc-20160816; b=lXmfh2gKmIIsnq4ZGKtgVmZgAeNAKW4RJGRGGQMlQPQNRt4f84wZmOXNc5CA2QHeC/ TkFr2TWZwt8NdgUUkobSI70f/vRzfHLhrag4Za3nyIq4SyzVqVieKADXs65tiH6OpjIX ledxVr5E+U9i2LeECfn8A33Kk0N+zRUDK5AREZxW/GqLakZuncMX4+ASQ246vMfUf6a3 u6vyv8EZAeP8na9qK1mPUm0S5se0ooYhgxOfI22HWEVWTyEm9VlCVqbIAOxSE7LMM4yE 7ymdzK8c6w4jd81X2pIlukg3bj6JRW+Ois/G2qLuCFCtzvW5ftZPgGz9xK5A/2f21/9o o7BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:references:message-id :content-transfer-encoding:cc:date:in-reply-to:from:subject :mime-version; bh=Pyjr0HjkeFCkZoZnesO7cmL+KokmaxPGkNdTDfCCuEI=; b=08hAkVpntEu0cSHpiAcG53yEx40i00sAL7sT2kAZtXqImUPHKy5DrdZfaP1UwESJPt gJp9CeVO2iIWBsp0oDYX1qOisl3sbbX9HkPl3SPCpzDF2G33ets+FV0aV+kLYnNdPFk3 u4oz53Q7eoT7zaQRjxtwsS/5Cyi8HpxWekV4c2JZ7Ir28KyqYwQvq51CqyU38a32roV3 3zI56ZNdlXHpEp+UvmgeIBOVzKOQO9v8D3gD4FmC5tHh8dlyah5WiVRtWrM9Ge4aldE5 01VU2BrFJeFnDETlbjGpD6crrsUNGc0gyqL2uhAXeVL3eH8WBKtyU7YlMnXvP8ScBNwa SDhg== 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 c20-20020a6566d4000000b003aaa7c6cf64si2527282pgw.216.2022.05.21.00.22.22; Sat, 21 May 2022 00:22:52 -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 S240529AbiESSI1 convert rfc822-to-8bit (ORCPT + 99 others); Thu, 19 May 2022 14:08:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39080 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241236AbiESSI0 (ORCPT ); Thu, 19 May 2022 14:08:26 -0400 Received: from mail.holtmann.org (coyote.holtmann.net [212.227.132.17]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 69C1D9E9D0 for ; Thu, 19 May 2022 11:08:24 -0700 (PDT) Received: from smtpclient.apple (p4ff9fb9d.dip0.t-ipconnect.de [79.249.251.157]) by mail.holtmann.org (Postfix) with ESMTPSA id B3644CECFA; Thu, 19 May 2022 20:08:23 +0200 (CEST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: Re: [PATCH v2 3/3] Bluetooth: hci_conn: Fix hci_connect_le_sync From: Marcel Holtmann In-Reply-To: <20220513235125.1364692-3-luiz.dentz@gmail.com> Date: Thu, 19 May 2022 20:08:23 +0200 Cc: linux-bluetooth@vger.kernel.org Content-Transfer-Encoding: 8BIT Message-Id: <6A7CED55-0DC1-48F1-95FF-A1B2ED3B280C@holtmann.org> References: <20220513235125.1364692-1-luiz.dentz@gmail.com> <20220513235125.1364692-3-luiz.dentz@gmail.com> To: Luiz Augusto von Dentz X-Mailer: Apple Mail (2.3696.100.31) X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,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 Luiz, > The handling of connection failures shall be handled by the request > completion callback as already done by hci_cs_le_create_conn, also make > sure to use hci_conn_failed instead of hci_le_conn_failed as the later > don't actually call hci_conn_del to cleanup. > > Fixes: 8e8b92ee60de5 ("Bluetooth: hci_sync: Add hci_le_create_conn_sync") > Signed-off-by: Luiz Augusto von Dentz > --- > net/bluetooth/hci_conn.c | 5 +++-- > net/bluetooth/hci_event.c | 8 +++++--- > 2 files changed, 8 insertions(+), 5 deletions(-) > > diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c > index 4a5193499b77..a36297368c58 100644 > --- a/net/bluetooth/hci_conn.c > +++ b/net/bluetooth/hci_conn.c > @@ -943,10 +943,11 @@ static void create_le_conn_complete(struct hci_dev *hdev, void *data, int err) > > bt_dev_err(hdev, "request failed to create LE connection: err %d", err); > > - if (!conn) > + /* Check if connection is still pending */ > + if (conn != hci_lookup_le_connect(hdev)) > goto done; > > - hci_le_conn_failed(conn, bt_status(err)); > + hci_conn_failed(conn, bt_status(err)); > > done: > hci_dev_unlock(hdev); > diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c > index 0270e597c285..af17dfb20e01 100644 > --- a/net/bluetooth/hci_event.c > +++ b/net/bluetooth/hci_event.c > @@ -5632,10 +5632,12 @@ static void le_conn_complete_evt(struct hci_dev *hdev, u8 status, > status = HCI_ERROR_INVALID_PARAMETERS; > } > > - if (status) { > - hci_conn_failed(conn, status); > + /* All connection failure handling is taken care of by the > + * hci_conn_failed function which is triggered by the HCI > + * request completion callbacks used for connecting. > + */ > + if (status) > goto unlock; > - } > > if (conn->dst_type == ADDR_LE_DEV_PUBLIC) > addr_type = BDADDR_LE_PUBLIC; can apply this patch alone and push it to -stable? Regards Marcel