diff mbox series

Bluetooth: Fix debugfs entry leak in hci_register_dev()

Message ID 20211013085546.101615-1-weiyongjun1@huawei.com (mailing list archive)
State Accepted
Headers show
Series Bluetooth: Fix debugfs entry leak in hci_register_dev() | expand

Checks

Context Check Description
tedd_an/checkpatch success Checkpatch PASS
tedd_an/gitlint success Gitlint PASS
tedd_an/buildkernel success Build Kernel PASS
tedd_an/testrunnersetup success Test Runner Setup PASS
tedd_an/testrunnerl2cap-tester success Total: 40, Passed: 40 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerbnep-tester success Total: 1, Passed: 1 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnermgmt-tester success Total: 468, Passed: 468 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnerrfcomm-tester success Total: 9, Passed: 9 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersco-tester success Total: 12, Passed: 12 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunnersmp-tester success Total: 8, Passed: 8 (100.0%), Failed: 0, Not Run: 0
tedd_an/testrunneruserchan-tester success Total: 4, Passed: 4 (100.0%), Failed: 0, Not Run: 0

Commit Message

Wei Yongjun Oct. 13, 2021, 8:55 a.m. UTC
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 <weiyongjun1@huawei.com>

Comments

bluez.test.bot@gmail.com Oct. 13, 2021, 9:10 a.m. UTC | #1
This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=562483

---Test result---

Test Summary:
CheckPatch                    PASS      1.89 seconds
GitLint                       PASS      0.96 seconds
BuildKernel                   PASS      528.68 seconds
TestRunner: Setup             PASS      412.56 seconds
TestRunner: l2cap-tester      PASS      9.14 seconds
TestRunner: bnep-tester       PASS      4.59 seconds
TestRunner: mgmt-tester       PASS      84.08 seconds
TestRunner: rfcomm-tester     PASS      5.58 seconds
TestRunner: sco-tester        PASS      6.17 seconds
TestRunner: smp-tester        PASS      5.86 seconds
TestRunner: userchan-tester   PASS      4.89 seconds



---
Regards,
Linux Bluetooth
Marcel Holtmann Oct. 13, 2021, 12:29 p.m. UTC | #2
Hi Wei,

> 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 <weiyongjun1@huawei.com>

patch has been applied to bluetooth-next tree.

Regards

Marcel
diff mbox series

Patch

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: