Bluetooth: l2cap: Process valid commands in too long frame
Subsystems (2)
PATCH v2 1/1 Bluetooth: l2cap: Process valid commands in too long frame
This is required for passing PTS test cases:
- L2CAP/COS/CED/BI-14-C
Multiple Signaling Command in one PDU, Data Truncated, BR/EDR, Connection Request
- L2CAP/COS/CED/BI-15-C
Multiple Signaling Command in one PDU, Data Truncated, BR/EDR, Disconnection Request
The test procedure defined in L2CAP.TS.p39 for both tests is:
1. The Lower Tester sends a C-frame to the IUT with PDU Length set to 8 and Channel ID set to the correct signaling channel for the logical link. The Information payload contains one L2CAP_ECHO_REQ packet with Data Length set to 0 with 0 octets of echo data and one command packet and Data Length set as specified in Table 4.6 and the correct command data.
2. The IUT sends an L2CAP_ECHO_RSP PDU to the Lower Tester.
3. Perform alternative 3A, 3B, 3C, or 3D depending on the IUT’s response.
Alternative 3A (IUT terminates the link):
3A.1 The IUT terminates the link.
3A.2 The test ends with a Pass verdict.
Alternative 3B (IUT discards the frame):
3B.1 The IUT does not send a reply to the Lower Tester.
Alternative 3C (IUT rejects PDU):
3C.1 The IUT sends an L2CAP_COMMAND_REJECT_RSP PDU to the
Lower Tester.
Alternative 3D (Any other IUT response):
3D.1 The Upper Tester issues a warning and the test ends.
4. The Lower Tester sends a C-frame to the IUT with PDU Length set to 4 and Channel ID set to the correct signaling channel for the logical link. The Information payload contains Data Length set to 0 with an L2CAP_ECHO_REQ packet with 0 octets of echo data.
5. The IUT sends an L2CAP_ECHO_RSP PDU to the Lower Tester.
With expected outcome:
In Steps 2 and 5, the IUT responds with an L2CAP_ECHO_RSP. In Step 3A.1, the IUT terminates the link.
In Step 3B.1, the IUT does not send a reply to the Lower Tester. In Step 3C.1, the IUT rejects the PDU.
In Step 3D.1, the IUT sends any valid response.
Currently PTS fails with the following logs:
Failed to receive ECHO RESPONSE.
And HCI logs:
Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 20
L2CAP: Information Response (0x0b) ident 2 len 12
Type: Fixed channels supported (0x0003)
Result: Success (0x0000)
Channels: 0x000000000000002e
L2CAP Signaling (BR/EDR)
Connectionless reception
AMP Manager Protocol
L2CAP Signaling (LE)Quoted 1 line
ACL Data RX: Handle 11 flags
0x02dlen 13
frame too long
08 01 00 00 08 02 01 00 aa .........
---v1->v2: Enhance comment with PTS test cases description
net/bluetooth/l2cap_core.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
net/bluetooth/l2cap_core.c +16 -0
@@ -7539,6 +7539,22 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)if (skb->len > len) {BT_ERR ("Frame is too long (len %u, expected len %d)" , skb->len, len); +/* PTS test cases L2CAP/COS/CED/BI-14-C and BI-15-C +* (Multiple Signaling Command in one PDU, Data +* Truncated, BR/EDR) send a C-frame to the IUT with +* PDU Length set to 8 and Channel ID set to the +* correct signaling channel for the logical link. +* The Information payload contains one L2CAP_ECHO_REQ +* packet with Data Length set to 0 with 0 octets of +* echo data and one invalid command packet due to +* data truncated in PDU but present in HCI packet. +* +* Shorter the socket buffer to the PDU length to +* allow to process valid commands from the PDU before +* setting the socket unreliable. +*/ + skb->len = len; +l2cap_recv_frame (conn, skb);l2cap_conn_unreliable (conn,ECOMM ); goto drop; }
Signature · 1 line
2.43.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=952988
---Test result---
Test Summary:
CheckPatch PENDING 0.40 seconds GitLint PENDING 0.39 seconds SubjectPrefix PASS 2.24 seconds BuildKernel PASS 24.51 seconds CheckAllWarning PASS 26.93 seconds CheckSparse PASS 30.37 seconds BuildKernel32 PASS 23.99 seconds TestRunnerSetup PASS 463.53 seconds TestRunner_l2cap-tester PASS 21.33 seconds TestRunner_iso-tester PASS 35.28 seconds TestRunner_bnep-tester PASS 4.79 seconds TestRunner_mgmt-tester FAIL 124.02 seconds TestRunner_rfcomm-tester PENDING 46.46 seconds TestRunner_sco-tester PASS 16.09 seconds TestRunner_ioctl-tester PASS 8.27 seconds TestRunner_mesh-tester PASS 5.95 seconds TestRunner_smp-tester PASS 20.67 seconds TestRunner_userchan-tester PASS 4.97 seconds IncrementalBuild PENDING 0.52 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner Output:
Total: 490, Passed: 483 (98.6%), Failed: 3, Not Run: 4
Failed Test Cases
LL Privacy - Add Device 2 (2 Devices to AL) Failed 0.171 seconds LL Privacy - Add Device 3 (AL is full) Failed 0.206 seconds LL Privacy - Set Flags 1 (Add to RL) Failed 0.150 seconds
##############################
Test: TestRunner_rfcomm-tester - PENDING
Desc: Run rfcomm-tester with test-runner Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series Output:
---
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 Mon, 14 Apr 2025 11:08:15 +0200 you wrote:
This is required for passing PTS test cases:
- L2CAP/COS/CED/BI-14-C
Multiple Signaling Command in one PDU, Data Truncated, BR/EDR, Connection Request
- L2CAP/COS/CED/BI-15-C
Multiple Signaling Command in one PDU, Data Truncated, BR/EDR, Disconnection Request[...]
Here is the summary with links:
- [v2] Bluetooth: l2cap: Process valid commands in too long frame
https://git.kernel.org/bluetooth/bluetooth-next/c/ad5747d4eed1
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html