[PW_SID:1098174] Bluetooth: L2CAP: Fix slab-use-after-free in l2cap_sock_cleanup_listen()#222
[PW_SID:1098174] Bluetooth: L2CAP: Fix slab-use-after-free in l2cap_sock_cleanup_listen()#222BluezTestBot wants to merge 6 commits into
Conversation
This patch adds workflow files for ci: [sync.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 Signed-off-by: Tedd Ho-Jeong An <tedd.an@intel.com>
This replaces the bzcafe action with bluez/action-ci so we can maintain everything in the github bluez organization Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
This attempts to sync every 5 minutes instead of 30. Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
bluez/action-ci uses master as default branch for workflow which is incorrect for kernel Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
The CI action now creates individual GitHub Check Runs per test, which requires 'checks: write' permission on the GITHUB_TOKEN. Also make the pull_request trigger types explicit to include 'reopened', allowing CI to be retriggered by closing and reopening a PR.
l2cap_sock_cleanup_listen() calls l2cap_chan_close() without holding conn->lock. A concurrent task iterating conn->chan_l under conn->lock can access a channel that has been removed from the list and freed. That can result in a slab-use-after-free. Split cleanup into two phases. Drain the accept queue under the parent's sk_lock onto a local list, taking a sock reference on each child so it survives the lock drop. Then release the parent and close every drained child under conn->lock + chan_lock, using l2cap_chan_hold_unless_zero()/l2cap_conn_hold_unless_zero() to cope with a teardown that has already started, and skipping any chan whose ->data has been cleared. Reacquire the parent's sk_lock at the end so the caller's contract is preserved. Noted that commit ab4eedb ("Bluetooth: L2CAP: Fix corrupted list in hci_chan_del") renamed chan_lock to lock in l2cap_conn. Fixes: 3df91ea ("Bluetooth: Revert to mutexes from RCU list") Cc: stable@kernel.org Assisted-by: Claude:claude-opus-4-7 Signed-off-by: Siwei Zhang <oss@fourdim.xyz>
|
CheckPatch |
|
GitLint |
|
SubjectPrefix |
|
BuildKernel |
|
CheckAllWarning |
|
CheckSparse |
|
BuildKernel32 |
|
TestRunnerSetup |
|
TestRunner_l2cap-tester |
|
IncrementalBuild |
e6b705e to
133f77d
Compare
l2cap_sock_cleanup_listen() calls l2cap_chan_close() without holding
conn->lock. A concurrent task iterating conn->chan_l under conn->lock
can access a channel that has been removed from the list and freed.
That can result in a slab-use-after-free.
Split cleanup into two phases. Drain the accept queue under the parent's
sk_lock onto a local list, taking a sock reference on each child so it
survives the lock drop. Then release the parent and close every drained
child under conn->lock + chan_lock, using
l2cap_chan_hold_unless_zero()/l2cap_conn_hold_unless_zero() to cope with
a teardown that has already started, and skipping any chan whose
->data has been cleared. Reacquire the parent's sk_lock at the end so
the caller's contract is preserved.
Noted that commit ab4eedb
("Bluetooth: L2CAP: Fix corrupted list in hci_chan_del")
renamed chan_lock to lock in l2cap_conn.
Fixes: 3df91ea ("Bluetooth: Revert to mutexes from RCU list")
Cc: stable@kernel.org
Assisted-by: Claude:claude-opus-4-7
Signed-off-by: Siwei Zhang oss@fourdim.xyz
net/bluetooth/l2cap_sock.c | 57 ++++++++++++++++++++++++++++++++------
1 file changed, 49 insertions(+), 8 deletions(-)