Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp3236600pxb; Wed, 13 Oct 2021 01:43:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx9kB6lfgvRl+oIaxom3smClEwU5jxXdqenBqwh7llHccJTN69TxchFfcJSUl14BLgdyRYA X-Received: by 2002:a17:90b:1649:: with SMTP id il9mr11824771pjb.167.1634114592412; Wed, 13 Oct 2021 01:43:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634114592; cv=none; d=google.com; s=arc-20160816; b=gKJA0aqk+WBNI3hqHerSRbZ+46OKqy7WS4V7KQ9NhqcE1kjEG7vgEoiWh3oVmeMb1t FcLQFtA8pK/0ZYASixhRvRzeRtdjY44g1Ut8E9qtHpZ9jC+FDaoKd8fFBz8JiR4pGKc+ Q3PtEvzMOE4o9IHzBLaw5WOweL7KjiOSUcEIlp9cZ4+71N9Mu0q4v0aofgGliXh3OOkh t/LIpLtuKv/NLEiTPsY952LwNZctrx84B2PitsTwJKUPd37xH8wq2wbI3NKDRQXWmDlu d0+cOpZOJgD87GEOJ+lObYtKoSLfmHNeLDsogfACaHhDAfjyVvGfN1EWtEV0YZquF9L3 xTyA== 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 :message-id:date:subject:cc:to:from; bh=AI67FJ0JQjeBDdl39iTwWgpdL9vpOFsX3DwyvhYRpvQ=; b=HSN3y97sBLAMBe6whPytWDprAFn+mtf1TTd7fz8Mg40aEM6cPZKTvHc4B/B0kIMPpj RGnwitHIh6rIh1eMdSpTde9XSjU1ZNeD7GGyRdZd8Jk6S0NyDM76VyaguoEOj5KyqIk/ 8DsEOpg9Ru8CqHl55ZVoXPDGPjX7bgjex+alSw2A3T6JCzuEi9O+/YrXf4MIlINdg8Tp MhJu6ONNc0ofJypu2QajU13wLUCxnQ/oJLyFroP/BMLtL/rcF04O6PwrAWelevBlX7p9 Pfj1S3GszhIHSKTAsoDSFIjCmmXvcKfxCKZVFpJH0+9ALkp5OEs4xnozykuBBL8tmKQI Z5DA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk6si7083615pjb.0.2021.10.13.01.42.54; Wed, 13 Oct 2021 01:43:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-bluetooth-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-bluetooth-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230461AbhJMIoO (ORCPT + 99 others); Wed, 13 Oct 2021 04:44:14 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:28926 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229902AbhJMIoO (ORCPT ); Wed, 13 Oct 2021 04:44:14 -0400 Received: from dggeml709-chm.china.huawei.com (unknown [172.30.72.53]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4HTmBF3lwQzbn45; Wed, 13 Oct 2021 16:37:41 +0800 (CST) Received: from localhost.localdomain.localdomain (10.175.113.25) by dggeml709-chm.china.huawei.com (10.3.17.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Wed, 13 Oct 2021 16:42:09 +0800 From: Wei Yongjun To: CC: Wei Yongjun , Marcel Holtmann , Johan Hedberg , Luiz Augusto von Dentz Subject: [PATCH] Bluetooth: Fix debugfs entry leak in hci_register_dev() Date: Wed, 13 Oct 2021 16:55:46 +0800 Message-ID: <20211013085546.101615-1-weiyongjun1@huawei.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.113.25] X-ClientProxiedBy: dggems701-chm.china.huawei.com (10.3.19.178) To dggeml709-chm.china.huawei.com (10.3.17.139) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-bluetooth@vger.kernel.org Fault injection test report debugfs entry leak as follows: debugfs: Directory 'hci0' with parent 'bluetooth' already present! When register_pm_notifier() failed in hci_register_dev(), the debugfs create by debugfs_create_dir() do not removed in the error handing path. Add the remove debugfs code to fix it. Signed-off-by: Wei Yongjun diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8a47a3017d61..cc48a8a9901c 100644 --- a/net/bluetooth/hci_core.c +++ b/net/bluetooth/hci_core.c @@ -3998,6 +3998,7 @@ int hci_register_dev(struct hci_dev *hdev) return id; err_wqueue: + debugfs_remove_recursive(hdev->debugfs); destroy_workqueue(hdev->workqueue); destroy_workqueue(hdev->req_workqueue); err: -- 2.25.1