From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id B57D4C433EF for ; Tue, 18 Jan 2022 02:37:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345532AbiARChS (ORCPT ); Mon, 17 Jan 2022 21:37:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244739AbiARCcp (ORCPT ); Mon, 17 Jan 2022 21:32:45 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E1D9C061753; Mon, 17 Jan 2022 18:31:56 -0800 (PST) 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 0B466610A3; Tue, 18 Jan 2022 02:31:56 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 60882C36AEF; Tue, 18 Jan 2022 02:31:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1642473115; bh=qF8ieuqvtPKzf5F6Iy6umtwvPPj1Fasnh7HBJ0ETD+0=; h=From:To:Cc:Subject:Date:From; b=pfSGbkIzsAnfm80fqFmGgtCGlhPxedJFRGOvb+ugvowauizpUm/yOXFJ3F1P97sAU pHPUnsTsd/hmNvRdB2elD+7WWlMKQ/3n+sFMNGIusPUvblV4V+Ysz0sGr7EMzwzdUc x0WfYu6X4+S1gNIIKLs3tspyaDd6LMqno5rk0eIGPEeRZG4laiGDpeyaGQQ9fKxuIO G0hgHLLn+5iH816FjwiD0RcigsKNFtBGjiibgdrzNQPtM5FpAPAUG9nJReRUtUzNiz t9IXeIaijG6Ntj6aaz5fnIPVOTnz9u9tyKBbvoxDCjss2xAAnPz9VSkwqiLwNmrNM+ dlNzihoUOb37g== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Wei Yongjun , Marcel Holtmann , Sasha Levin , johan.hedberg@gmail.com, luiz.dentz@gmail.com, davem@davemloft.net, kuba@kernel.org, linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org Subject: [PATCH AUTOSEL 5.15 001/188] Bluetooth: Fix debugfs entry leak in hci_register_dev() Date: Mon, 17 Jan 2022 21:28:45 -0500 Message-Id: <20220118023152.1948105-1-sashal@kernel.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Wei Yongjun [ Upstream commit 5a4bb6a8e981d3d0d492aa38412ee80b21033177 ] 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 Signed-off-by: Marcel Holtmann Signed-off-by: Sasha Levin --- net/bluetooth/hci_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c index 8a47a3017d61d..cc48a8a9901c0 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.34.1