* [PATCH] Bluetooth: hci_core: free the HCI ID if naming fails
@ 2026-09-21 18:49 Sang-Hoon Choi
2026-09-21 21:27 ` bluez.test.bot
2026-09-22 15:00 ` [PATCH] " patchwork-bot+bluetooth
0 siblings, 2 replies; 3+ messages in thread
From: Sang-Hoon Choi @ 2026-09-21 18:49 UTC (permalink / raw)
To: Marcel Holtmann, Luiz Augusto von Dentz; +Cc: linux-bluetooth, Changyul Lee
hci_register_dev() allocates an ID before calling dev_set_name().
If naming fails, it returns without releasing that ID. The device has
not been registered and hdev->id has not been assigned, so the normal
unregister path cannot release it.
Free the allocated ID before returning the naming error.
Fixes: dcda165706b9 ("Bluetooth: hci_core: Fix build warnings")
Reported-by: Changyul Lee <lcy8047@gmail.com>
Assisted-by: LLM
Signed-off-by: Sang-Hoon Choi <csh0052@gmail.com>
---
Found during source review at mainline
5dd1818b15d98d4a20806cd00b1b40320b06004f. The affected source is unchanged
at f0100363d8c374bd8e9ea7c9ba02744f0b802ca4.
The modified hci_core.o compiled with x86 allmodconfig and W=1.
I have not exercised the dev_set_name() failure path at runtime.
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index d183efaf9..bbe391525 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2557,8 +2557,10 @@ int hci_register_dev(struct hci_dev *hdev)
return id;
error = dev_set_name(&hdev->dev, "hci%u", id);
- if (error)
+ if (error) {
+ ida_free(&hci_index_ida, id);
return error;
+ }
hdev->name = dev_name(&hdev->dev);
hdev->id = id;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: hci_core: free the HCI ID if naming fails
2026-09-21 18:49 [PATCH] Bluetooth: hci_core: free the HCI ID if naming fails Sang-Hoon Choi
@ 2026-09-21 21:27 ` bluez.test.bot
2026-09-22 15:00 ` [PATCH] " patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2026-09-21 21:27 UTC (permalink / raw)
To: linux-bluetooth, csh0052
[-- Attachment #1: Type: text/plain, Size: 2758 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/series/1170616/
---Test result---
Test Summary:
CheckPatch FAIL 9.69 seconds
VerifyFixes PASS 0.18 seconds
VerifySignedoff PASS 0.13 seconds
GitLint PASS 0.35 seconds
SubjectPrefix PASS 0.13 seconds
BuildKernel PASS 29.86 seconds
CheckAllWarning PASS 34.47 seconds
CheckSparse PASS 38.86 seconds
BuildKernel32 PASS 29.69 seconds
CheckKernelLLVM PASS 35.33 seconds
TestRunnerSetup PASS 790.99 seconds
TestRunner_l2cap-tester PASS 16.44 seconds
TestRunner_iso-tester PASS 29.05 seconds
TestRunner_bnep-tester PASS 3.17 seconds
TestRunner_mgmt-tester PASS 61.53 seconds
TestRunner_rfcomm-tester PASS 4.49 seconds
TestRunner_sco-tester PASS 8.78 seconds
TestRunner_ioctl-tester PASS 4.72 seconds
TestRunner_mesh-tester FAIL 7.84 seconds
TestRunner_smp-tester PASS 4.34 seconds
TestRunner_userchan-tester PASS 3.20 seconds
TestRunner_6lowpan-tester PASS 4.43 seconds
IncrementalBuild PASS 28.30 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
Bluetooth: hci_core: free the HCI ID if naming fails
WARNING: Reported-by: should be immediately followed by Closes: or Link: with a URL to the report
#105:
Reported-by: Changyul Lee <lcy8047@gmail.com>
Assisted-by: LLM
total: 0 errors, 1 warnings, 0 checks, 11 lines checked
NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.
/home/runner/work/bluetooth-next/bluetooth-next/src/patch/14836139.patch has style problems, please review.
NOTE: Ignored message types: UNKNOWN_COMMIT_ID
NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.
##############################
Test: TestRunner_mesh-tester - FAIL
Desc: Run mesh-tester with test-runner
Output:
Total: 10, Passed: 8 (80.0%), Failed: 2, Not Run: 0
Failed Test Cases
Mesh - Send cancel - 1 Timed out 2.371 seconds
Mesh - Send cancel - 2 Timed out 1.999 seconds
https://github.com/bluez/bluetooth-next/pull/809
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: hci_core: free the HCI ID if naming fails
2026-09-21 18:49 [PATCH] Bluetooth: hci_core: free the HCI ID if naming fails Sang-Hoon Choi
2026-09-21 21:27 ` bluez.test.bot
@ 2026-09-22 15:00 ` patchwork-bot+bluetooth
1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+bluetooth @ 2026-09-22 15:00 UTC (permalink / raw)
To: Sang-Hoon Choi; +Cc: marcel, luiz.dentz, linux-bluetooth, lcy8047
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Tue, 22 Sep 2026 03:49:28 +0900 you wrote:
> hci_register_dev() allocates an ID before calling dev_set_name().
> If naming fails, it returns without releasing that ID. The device has
> not been registered and hdev->id has not been assigned, so the normal
> unregister path cannot release it.
>
> Free the allocated ID before returning the naming error.
>
> [...]
Here is the summary with links:
- Bluetooth: hci_core: free the HCI ID if naming fails
https://git.kernel.org/bluetooth/bluetooth-next/c/7348abd83a3b
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-09-22 15:01 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-21 18:49 [PATCH] Bluetooth: hci_core: free the HCI ID if naming fails Sang-Hoon Choi
2026-09-21 21:27 ` bluez.test.bot
2026-09-22 15:00 ` [PATCH] " patchwork-bot+bluetooth
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.