Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp423152rwr; Wed, 3 May 2023 00:07:46 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4X8v+0fu359vkkr2H155l9ifycq65X3+EUQm/xv1iyRjYXrP2LPRqmkvHaeUpF7Nqkmc5c X-Received: by 2002:a17:902:c948:b0:1a9:6d25:b2d2 with SMTP id i8-20020a170902c94800b001a96d25b2d2mr1197649pla.67.1683097666419; Wed, 03 May 2023 00:07:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683097666; cv=none; d=google.com; s=arc-20160816; b=s2s/fHV5BNRFl17hA0n+XrQxWkVTXlmWBuh2Jv3cSB9duV0CaN+LXlUuV0xlX9vmmo cpadQ0iowECNeJbTE+yVHXYxxoNDZeX2FdgPI4VI3Bnlga6LXz6xP6jrQ6VRRz2UszA/ JncpjLKb8E4X/xWS7IFRBLGGwW+3e2qDDjpgSvM3s7ww3lz0E28QSZ6m8JwOzxWSaXza HrOijO9zcjdUVbbPj5/52IyYVD/s4FZcY3yOwCj0M/2YcRjopicwpJg6k12752jVye0T VhtfDT+aVHkGTFSapnK6eMhzNZMhGcCra9duBvkuYoThnlrGBpqtaZx/NS7IxyqtNeH1 hzcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=2yWIwdj3aB7e6OvEf6mt/2BTF89ERjXLKRciHW3bYT0=; b=ClQZLYSeScHVGsZgziop5OLcdjGi/u4kL3QTeDPcfzVAz0JdDZ9FYX3lGQ1bmMhQeo UQG3PI+H1Pt6SMrDw6QgVF9oNcmJeVqmU/JcMmRCQ+SyjSQ0zcxxwda7NERVgIXwg7Fg r/XTUe0aGPyt3R/UucsPRAg3p+qWejU+xEImEXqNq3eV2sVBNiFMqgkKAc4/ZP5ojiX6 EvBSygW09Mb96Rz2xP/7fjVYU11RUONUf5SVvEFYG7u8KZ0/I3cAtNWHW3C3oRrAiBYA es3HRJRY0NJfNEmJz/ANy9qE0TetblgSXnJl1xZPA0bff+3KBFrZbJuUkOVhHJxQRYvt y8Cg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=akIxmMM8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id j7-20020a170903024700b0019e88376e3csi30482436plh.162.2023.05.03.00.07.31; Wed, 03 May 2023 00:07:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-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=@kernel.org header.s=k20201202 header.b=akIxmMM8; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229626AbjECHEq (ORCPT + 99 others); Wed, 3 May 2023 03:04:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50326 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229491AbjECHEp (ORCPT ); Wed, 3 May 2023 03:04:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CA64E269D; Wed, 3 May 2023 00:04:43 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 63A8160AF8; Wed, 3 May 2023 07:04:43 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AEA42C433EF; Wed, 3 May 2023 07:04:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1683097482; bh=M0BKie22cDJLEmh+DW1hFkVbxx3BKs6v3GQgOxwOC1I=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=akIxmMM83ZB7scSmRZabtnBDF9G9XAKAY+Apri/LWfcfuxEo7vOzWAjEdK6J49uqy 4NQpck+EzQRCVS5oBNJzbFCUkmOGhaLuR+3JxZHzabUu5RPbIMMA4Jk9ar+O2SlULV Yy3nelM0+CZr4sAlUkbo0ugEc1qdsKMWvQGrkIgpojwEIRxsZqt8QGvw6GoDixE/fP Kd0G8XunzTC47/LiWrcWmcP3eUiM8jqK5/wfo/0s+ASN//phlEGvWQHWuF7AHnadyL 26PupfT3VPijmSYy65DCZNMDvsi8rPSj5+lOc3MqhI8I8Y+TEmHHGlSBflyv6Z9czG EhywdUTYAeYhA== Received: from johan by xi.lan with local (Exim 4.94.2) (envelope-from ) id 1pu6Xf-0007Og-E0; Wed, 03 May 2023 09:04:47 +0200 Date: Wed, 3 May 2023 09:04:47 +0200 From: Johan Hovold To: Luiz Augusto von Dentz Cc: Johan Hovold , Marcel Holtmann , Johan Hedberg , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , linux-bluetooth@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, stable@vger.kernel.org Subject: Re: [PATCH 1/2] Bluetooth: fix debugfs registration Message-ID: References: <20230424124852.12625-1-johan+linaro@kernel.org> <20230424124852.12625-2-johan+linaro@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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-kernel@vger.kernel.org On Tue, May 02, 2023 at 04:37:51PM -0700, Luiz Augusto von Dentz wrote: > Hi Johan, > > On Mon, Apr 24, 2023 at 5:50 AM Johan Hovold wrote: > > > > Since commit ec6cef9cd98d ("Bluetooth: Fix SMP channel registration for > > unconfigured controllers") the debugfs interface for unconfigured > > controllers will be created when the controller is configured. > > > > There is however currently nothing preventing a controller from being > > configured multiple time (e.g. setting the device address using btmgmt) > > which results in failed attempts to register the already registered > > debugfs entries: > > > > debugfs: File 'features' in directory 'hci0' already present! > > debugfs: File 'manufacturer' in directory 'hci0' already present! > > debugfs: File 'hci_version' in directory 'hci0' already present! > > ... > > debugfs: File 'quirk_simultaneous_discovery' in directory 'hci0' already present! > > > > Add a controller flag to avoid trying to register the debugfs interface > > more than once. > > > > Fixes: ec6cef9cd98d ("Bluetooth: Fix SMP channel registration for unconfigured controllers") > > Cc: stable@vger.kernel.org # 4.0 > > Signed-off-by: Johan Hovold > > --- > > diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c > > index 632be1267288..a8785126df75 100644 > > --- a/net/bluetooth/hci_sync.c > > +++ b/net/bluetooth/hci_sync.c > > @@ -4501,6 +4501,9 @@ static int hci_init_sync(struct hci_dev *hdev) > > !hci_dev_test_flag(hdev, HCI_CONFIG)) > > return 0; > > > > + if (hci_dev_test_and_set_flag(hdev, HCI_DEBUGFS_CREATED)) > > + return 0; > > Can't we just use HCI_SETUP like we do with in create_basic: > > if (hci_dev_test_flag(hdev, HCI_SETUP)) > hci_debugfs_create_basic(hdev); > > Actually we might as well move these checks directly inside the > hci_debugfs function to make sure these only take effect during the > setup/first init. The problem is that commit ec6cef9cd98d ("Bluetooth: Fix SMP channel registration for unconfigured controllers") started deferring creation of most parts of the debugfs interface until the controller is configured (e.g. as some information is not available until then). Moving everything back to setup-time would effectively revert that. Perhaps the interface can be changed in some way so that everything is again registered at setup-time (e.g. with placeholder values instead of conditionally created attributes), but that would at least not be something that we could backport. > > hci_debugfs_create_common(hdev); > > > > if (lmp_bredr_capable(hdev)) Johan