* [PATCH v2] Bluetooth: hci_core: fix error handling in hci_register_dev()
@ 2022-10-19 8:06 Yang Yingliang
2022-10-19 9:27 ` [v2] " bluez.test.bot
0 siblings, 1 reply; 2+ messages in thread
From: Yang Yingliang @ 2022-10-19 8:06 UTC (permalink / raw
To: linux-bluetooth
Cc: marcel, johan.hedberg, luiz.dentz, luiz.von.dentz, yangyingliang
If hci_register_suspend_notifier() returns error, the hdev
need to be put and deleted and rfkill need be unregistered
and destroyed to avoid leaks.
Fixes: 9952d90ea288 ("Bluetooth: Handle PM_SUSPEND_PREPARE and PM_POST_SUSPEND")
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
---
v1 -> v2:
Add rfkill_destroy().
---
net/bluetooth/hci_core.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 0540555b3704..a6222238de7f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2660,7 +2660,7 @@ int hci_register_dev(struct hci_dev *hdev)
error = hci_register_suspend_notifier(hdev);
if (error)
- goto err_wqueue;
+ goto err_hdev;
queue_work(hdev->req_workqueue, &hdev->power_on);
@@ -2669,6 +2669,14 @@ int hci_register_dev(struct hci_dev *hdev)
return id;
+err_hdev:
+ hci_dev_put(hdev);
+ if (hdev->rfkill) {
+ rfkill_unregister(hdev->rfkill);
+ rfkill_destroy(hdev->rfkill);
+ hdev->rfkill = NULL;
+ }
+ device_del(&hdev->dev);
err_wqueue:
debugfs_remove_recursive(hdev->debugfs);
destroy_workqueue(hdev->workqueue);
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* RE: [v2] Bluetooth: hci_core: fix error handling in hci_register_dev()
2022-10-19 8:06 [PATCH v2] Bluetooth: hci_core: fix error handling in hci_register_dev() Yang Yingliang
@ 2022-10-19 9:27 ` bluez.test.bot
0 siblings, 0 replies; 2+ messages in thread
From: bluez.test.bot @ 2022-10-19 9:27 UTC (permalink / raw
To: linux-bluetooth, yangyingliang
[-- Attachment #1: Type: text/plain, Size: 1259 bytes --]
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=686590
---Test result---
Test Summary:
CheckPatch PASS 1.73 seconds
GitLint PASS 1.02 seconds
SubjectPrefix PASS 0.84 seconds
BuildKernel PASS 33.97 seconds
BuildKernel32 PASS 29.79 seconds
Incremental Build with patchesPASS 43.47 seconds
TestRunner: Setup PASS 502.40 seconds
TestRunner: l2cap-tester PASS 17.18 seconds
TestRunner: iso-tester PASS 15.97 seconds
TestRunner: bnep-tester PASS 6.35 seconds
TestRunner: mgmt-tester PASS 102.59 seconds
TestRunner: rfcomm-tester PASS 10.10 seconds
TestRunner: sco-tester PASS 9.52 seconds
TestRunner: ioctl-tester PASS 10.69 seconds
TestRunner: mesh-tester PASS 7.66 seconds
TestRunner: smp-tester PASS 9.45 seconds
TestRunner: userchan-tester PASS 6.48 seconds
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-10-19 9:55 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-10-19 8:06 [PATCH v2] Bluetooth: hci_core: fix error handling in hci_register_dev() Yang Yingliang
2022-10-19 9:27 ` [v2] " bluez.test.bot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).