Skip to content

[PW_SID:1092984] Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_new_connection_cb()#3000

Closed
tedd-an wants to merge 2 commits into
workflowfrom
1092984
Closed

[PW_SID:1092984] Bluetooth: L2CAP: Fix use-after-free in l2cap_sock_new_connection_cb()#3000
tedd-an wants to merge 2 commits into
workflowfrom
1092984

Conversation

@tedd-an
Copy link
Copy Markdown
Owner

@tedd-an tedd-an commented May 11, 2026

l2cap_sock_new_connection_cb() accesses l2cap_pi(sk)->chan after
release_sock(parent). Once the parent lock is released, the child
socket sk can be freed by another task.

Save the channel pointer into a local variable while the parent lock
is still held to prevent this.

Fixes: 8ffb929 ("Bluetooth: Remove parent socket usage from l2cap_core.c")
Cc: stable@kernel.org
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Siwei Zhang oss@fourdim.xyz

net/bluetooth/6lowpan.c | 5 +++++
net/bluetooth/l2cap_core.c | 12 ++++++++++++
net/bluetooth/l2cap_sock.c | 13 ++++++++++++-
net/bluetooth/smp.c | 5 +++++
4 files changed, 34 insertions(+), 1 deletion(-)

tedd-an and others added 2 commits May 11, 2026 16:41
This patch adds workflow files for ci:

[schedule_work.yml]
 - The workflow file for scheduled work
 - Sync the repo with upstream repo and rebase the workflow branch
 - Review the patches in the patchwork and creates the PR if needed

[ci.yml]
 - The workflow file for CI tasks
 - Run CI tests when PR is created
l2cap_sock_new_connection_cb() accesses l2cap_pi(sk)->chan after
release_sock(parent). Once the parent lock is released, the child
socket sk can be freed by another task.

Save the channel pointer into a local variable while the parent lock
is still held to prevent this.

Fixes: 8ffb929 ("Bluetooth: Remove parent socket usage from l2cap_core.c")
Cc: stable@kernel.org
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Siwei Zhang <oss@fourdim.xyz>
@github-actions github-actions Bot force-pushed the workflow branch 5 times, most recently from d597d95 to 2116964 Compare May 15, 2026 17:57
@github-actions github-actions Bot force-pushed the workflow branch 2 times, most recently from a940bb1 to 479b41a Compare May 19, 2026 17:00
@tedd-an tedd-an closed this May 20, 2026
@tedd-an tedd-an deleted the 1092984 branch May 20, 2026 17:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants