Bluetooth: ISO: Fix not releasing hdev reference on iso_conn_big_sync
Subsystems (2)
Luiz Augusto von Dentz
maintainerPATCH v2 1/2 Bluetooth: ISO: Fix not releasing hdev reference on iso_conn_big_sync
From: Luiz Augusto von Dentz <[email protected]>
hci_get_route() returns a reference-counted hci_dev pointer via hci_dev_hold(). The function exits normally or with an error without ever releasing it.
--- net/bluetooth/iso.c | 1 + 1 file changed, 1 insertion(+)
net/bluetooth/iso.c +1 -0
@@ -1596,6 +1596,7 @@ static void iso_conn_big_sync(struct sock *sk)release_sock (sk);hci_dev_unlock (hdev); +hci_dev_put (hdev); } static int iso_sock_recvmsg(struct socket *sock, struct msghdr *msg,
Signature · 1 line
2.53.0
Luiz Augusto von Dentz
maintainerPATCH v2 2/2 Bluetooth: ISO: Fix a use-after-free of the hci_conn pointer
From: Luiz Augusto von Dentz <[email protected]>
In iso_sock_rebind_bc(), the bis pointer is cached, then the socket lock is dropped:
bis = iso_pi(sk)->conn->hcon; /* Release the socket before lookups since that requires hci_dev_lock * which shall not be acquired while holding sock_lock for proper * ordering. */ release_sock(sk); hci_dev_lock(bis->hdev);
During the unlocked window, could a concurrent close() destroy the connection and free the bis structure, causing hci_dev_lock(bis->hdev) to access memory after it is freed, fix this by using the hdev reference which was safely acquired via iso_conn_get_hdev().
--- net/bluetooth/iso.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
net/bluetooth/iso.c +1 -1
@@ -1083,7 +1083,7 @@ static int iso_sock_rebind_bc(struct sock *sk, struct sockaddr_iso *sa,* ordering. */ release_sock (sk); -hci_dev_lock (bis->hdev); +hci_dev_lock (hdev);lock_sock (sk);if (!iso_pi (sk)->conn ||iso_pi (sk)->conn->hcon != bis) {
Signature · 1 line
2.53.0
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=1104231
---Test result---
Test Summary:
CheckPatch FAIL 1.31 seconds VerifyFixes PASS 0.12 seconds VerifySignedoff PASS 0.12 seconds GitLint FAIL 0.59 seconds SubjectPrefix PASS 0.22 seconds BuildKernel PASS 24.89 seconds CheckAllWarning PASS 27.42 seconds CheckSparse PASS 26.41 seconds BuildKernel32 PASS 24.37 seconds TestRunnerSetup PASS 520.37 seconds TestRunner_iso-tester PASS 78.40 seconds IncrementalBuild PASS 26.38 seconds
Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[v2,1/2] Bluetooth: ISO: Fix not releasing hdev reference on iso_conn_big_sync
WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report #103:
total: 0 errors, 1 warnings, 0 checks, 7 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.
/github/workspace/src/patch/14605715.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.
[v2,2/2] Bluetooth: ISO: Fix a use-after-free of the hci_conn pointer
WARNING: Prefer a maximum 75 chars per line (possible unwrapped commit description?) #112:
During the unlocked window, could a concurrent close() destroy the connection
WARNING: Reported-by: should be immediately followed by Closes: with a URL to the report #118:
total: 0 errors, 2 warnings, 0 checks, 8 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.
/github/workspace/src/patch/14605716.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: GitLint - FAIL
Desc: Run gitlint
Output:
[v2,2/2] Bluetooth: ISO: Fix a use-after-free of the hci_conn pointer
7: B3 Line contains hard tab characters (\t): " bis = iso_pi(sk)->conn->hcon;"
8: B3 Line contains hard tab characters (\t): " /* Release the socket before lookups since that requires hci_dev_lock"
9: B3 Line contains hard tab characters (\t): " * which shall not be acquired while holding sock_lock for proper"
10: B3 Line contains hard tab characters (\t): " * ordering."
11: B3 Line contains hard tab characters (\t): " */"
12: B3 Line contains hard tab characters (\t): " release_sock(sk);"
13: B3 Line contains hard tab characters (\t): " hci_dev_lock(bis->hdev);"
https://github.com/bluez/bluetooth-next/pull/271
---
Regards,
Linux Bluetooth
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This series was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 11 lines · On Mon, 1 Jun 2026 16:41:56 -0400 you wrote:
From: Luiz Augusto von Dentz <[email protected]>
hci_get_route()returns a reference-countedhci_devpointer viahci_dev_hold(). The function exits normally or with an error without ever releasing it.Fixes 07a9342b94a9 ("Bluetooth: ISO: Send BIG Create Sync via hci_sync")Reported-by Sashiko <[email protected]>Signed-off-by Luiz Augusto von Dentz <[email protected]>[...]
Here is the summary with links:
- [v2,1/2] Bluetooth: ISO: Fix not releasing hdev reference on iso_conn_big_sync
https://git.kernel.org/bluetooth/bluetooth-next/c/59e3efb116d4 - [v2,2/2] Bluetooth: ISO: Fix a use-after-free of the hci_conn pointer https://git.kernel.org/bluetooth/bluetooth-next/c/e13696f42ec9
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html