Skip to content

Commit a43ae7c

Browse files
author
Paolo Abeni
committed
Merge tag 'for-net-2025-04-16' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
Luiz Augusto von Dentz says: ==================== bluetooth pull request for net: - l2cap: Process valid commands in too long frame - vhci: Avoid needless snprintf() calls * tag 'for-net-2025-04-16' of git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth: Bluetooth: vhci: Avoid needless snprintf() calls Bluetooth: l2cap: Process valid commands in too long frame ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
2 parents f49a372 + 875db86 commit a43ae7c

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

drivers/bluetooth/hci_vhci.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -289,18 +289,18 @@ static void vhci_coredump(struct hci_dev *hdev)
289289

290290
static void vhci_coredump_hdr(struct hci_dev *hdev, struct sk_buff *skb)
291291
{
292-
char buf[80];
292+
const char *buf;
293293

294-
snprintf(buf, sizeof(buf), "Controller Name: vhci_ctrl\n");
294+
buf = "Controller Name: vhci_ctrl\n";
295295
skb_put_data(skb, buf, strlen(buf));
296296

297-
snprintf(buf, sizeof(buf), "Firmware Version: vhci_fw\n");
297+
buf = "Firmware Version: vhci_fw\n";
298298
skb_put_data(skb, buf, strlen(buf));
299299

300-
snprintf(buf, sizeof(buf), "Driver: vhci_drv\n");
300+
buf = "Driver: vhci_drv\n";
301301
skb_put_data(skb, buf, strlen(buf));
302302

303-
snprintf(buf, sizeof(buf), "Vendor: vhci\n");
303+
buf = "Vendor: vhci\n";
304304
skb_put_data(skb, buf, strlen(buf));
305305
}
306306

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)