Bluetooth: hci_event: validate LE Set CIG Parameters response
Subsystems (2)
PATCH 1/1 Bluetooth: hci_event: validate LE Set CIG Parameters response
The Command Complete dispatch validates only the fixed part of the LE Set CIG Parameters response. After that part is pulled from the skb, hci_cc_le_set_cig_params() trusts num_handles and reads each entry in the trailing handle array.
Matching num_handles against the command's num_cis does not guarantee that the response contains the advertised handles. A truncated response from a malfunctioning controller can therefore make the handler read beyond the skb data.
Validate that the remaining skb data contains all advertised handles. Include this in the existing response validation so malformed responses also follow the established CIG failure handling.
net/bluetooth/hci_event.c +4 -2
@@ -3827,8 +3827,10 @@ static u8 hci_cc_le_set_cig_params(struct hci_dev *hdev, void *data,bt_dev_dbg (hdev,"status 0x%2.2x" , rp->status); cp =hci_sent_cmd_data (hdev,HCI_OP_LE_SET_CIG_PARAMS ); -if (!rp->status && (!cp || rp->num_handles != cp->num_cis || - rp->cig_id != cp->cig_id)) { +if (!rp->status && + (!cp || rp->num_handles != cp->num_cis || + rp->cig_id != cp->cig_id || + skb->len <array_size (rp->num_handles,sizeof (*rp->handle)))) {bt_dev_err (hdev,"unexpected Set CIG Parameters response data" ); status =HCI_ERROR_UNSPECIFIED ; }
Signature · 1 line
2.51.2
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=1138692
---Test result---
Test Summary:
CheckPatch PASS 0.69 seconds VerifyFixes PASS 0.11 seconds VerifySignedoff PASS 0.11 seconds GitLint PASS 0.29 seconds SubjectPrefix PASS 0.11 seconds BuildKernel PASS 27.45 seconds CheckAllWarning PASS 35.39 seconds CheckSparse PASS 28.35 seconds BuildKernel32 PASS 26.41 seconds CheckKernelLLVM SKIP 0.00 seconds TestRunnerSetup PASS 499.93 seconds TestRunner_l2cap-tester PASS 62.82 seconds TestRunner_iso-tester PASS 91.17 seconds TestRunner_bnep-tester PASS 19.73 seconds TestRunner_mgmt-tester FAIL 223.27 seconds TestRunner_rfcomm-tester PASS 25.86 seconds TestRunner_sco-tester PASS 32.25 seconds TestRunner_ioctl-tester PASS 26.48 seconds TestRunner_mesh-tester FAIL 25.91 seconds TestRunner_smp-tester PASS 23.26 seconds TestRunner_userchan-tester PASS 20.15 seconds TestRunner_6lowpan-tester PASS 23.12 seconds IncrementalBuild PASS 25.88 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis Output:
Clang not found
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 501, Passed: 496 (99.0%), Failed: 1, Not Run: 4
Failed Test Cases
Read Exp Feature - Success Failed 0.244 seconds
##############################
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 1.945 seconds Mesh - Send cancel - 2 Timed out 1.989 seconds
https://github.com/bluez/bluetooth-next/pull/525
---
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 11 lines · On Sat, 1 Aug 2026 23:54:52 +0545 you wrote:
The Command Complete dispatch validates only the fixed part of the LE Set CIG Parameters response. After that part is pulled from the skb,
hci_cc_le_set_cig_params()trustsnum_handlesand reads each entry in the trailing handle array.Matching
num_handlesagainst the command'snum_cisdoes not guarantee that the response contains the advertised handles. A truncated response from a malfunctioning controller can therefore make the handler read beyond the skb data.[...]
Here is the summary with links:
- Bluetooth: hci_event: validate LE Set CIG Parameters response
https://git.kernel.org/bluetooth/bluetooth-next/c/bece7ec4e259
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html