Skip to content

Commit e2e49e2

Browse files
fdanis-ossVudentz
authored andcommitted
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: > ACL Data RX: Handle 11 flags 0x02 dlen 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) > ACL Data RX: Handle 11 flags 0x02 dlen 13 frame too long 08 01 00 00 08 02 01 00 aa ......... Cc: [email protected] Signed-off-by: Frédéric Danis <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent adf6b73 commit e2e49e2

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

net/bluetooth/l2cap_core.c

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7539,8 +7539,24 @@ void l2cap_recv_acldata(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
75397539
if (skb->len > len) {
75407540
BT_ERR("Frame is too long (len %u, expected len %d)",
75417541
skb->len, len);
7542+
/* PTS test cases L2CAP/COS/CED/BI-14-C and BI-15-C
7543+
* (Multiple Signaling Command in one PDU, Data
7544+
* Truncated, BR/EDR) send a C-frame to the IUT with
7545+
* PDU Length set to 8 and Channel ID set to the
7546+
* correct signaling channel for the logical link.
7547+
* The Information payload contains one L2CAP_ECHO_REQ
7548+
* packet with Data Length set to 0 with 0 octets of
7549+
* echo data and one invalid command packet due to
7550+
* data truncated in PDU but present in HCI packet.
7551+
*
7552+
* Shorter the socket buffer to the PDU length to
7553+
* allow to process valid commands from the PDU before
7554+
* setting the socket unreliable.
7555+
*/
7556+
skb->len = len;
7557+
l2cap_recv_frame(conn, skb);
75427558
l2cap_conn_unreliable(conn, ECOMM);
7543-
goto drop;
7559+
goto unlock;
75447560
}
75457561

75467562
/* Append fragment into frame (with header) */

0 commit comments

Comments
 (0)