Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn
Subsystems (2)
PATCH 1/1 Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn
__set_chan_timer() takes a l2cap_chan reference via l2cap_chan_hold() before scheduling the delayed work. The normal path in l2cap_chan_timeout() drops this reference with l2cap_chan_put() at the end, but the early return when chan->conn is NULL skips the put, leaking the reference.
Add the missing l2cap_chan_put() before the early return.
--- net/bluetooth/l2cap_core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
net/bluetooth/l2cap_core.c +3 -1
@@ -411,8 +411,10 @@ static void l2cap_chan_timeout(struct work_struct *work)BT_DBG ("chan %p state %s" , chan,state_to_string (chan->state)); -if (!conn) +if (!conn) { +l2cap_chan_put (chan);return ; + }mutex_lock (&conn->lock);/* __set_chan_timer() calls l2cap_chan_hold(chan) while scheduling
Signature · 1 line
2.54.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=1098397
---Test result---
Test Summary:
CheckPatch PASS 0.74 seconds GitLint PASS 0.34 seconds SubjectPrefix PASS 0.13 seconds BuildKernel PASS 25.59 seconds CheckAllWarning PASS 27.76 seconds CheckSparse PASS 26.46 seconds BuildKernel32 PASS 24.69 seconds TestRunnerSetup PASS 530.44 seconds TestRunner_l2cap-tester PASS 374.90 seconds IncrementalBuild PASS 24.34 seconds
https://github.com/bluez/bluetooth-next/pull/226
---
Regards,
Linux Bluetooth
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master) by Luiz Augusto von Dentz <[email protected]>:
Quoted 9 lines · On Wed, 20 May 2026 22:30:36 -0400 you wrote:
__set_chan_timer()takes al2cap_chanreference vial2cap_chan_hold()before scheduling the delayed work. The normal path inl2cap_chan_timeout()drops this reference withl2cap_chan_put()at the end, but the early return whenchan->connis NULL skips the put, leaking the reference.Add the missing
l2cap_chan_put()before the early return.[...]
Here is the summary with links:
- Bluetooth: L2CAP: fix chan ref leak in l2cap_chan_timeout() on !conn
https://git.kernel.org/bluetooth/bluetooth-next/c/628669434306
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html