Skip to content

Commit 2f10e40

Browse files
pvVudentz
authored andcommitted
Bluetooth: ISO: fix timestamped HCI ISO data packet parsing
Use correct HCI ISO data packet header struct when the packet has timestamp. The timestamp, when present, goes before the other fields (Core v5.3 4E 5.4.5), so the structs are not compatible. Fixes: ccf74f2 ("Bluetooth: Add BTPROTO_ISO socket type") Signed-off-by: Pauli Virtanen <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent efe375b commit 2f10e40

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

net/bluetooth/iso.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1620,7 +1620,6 @@ static void iso_disconn_cfm(struct hci_conn *hcon, __u8 reason)
16201620
void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
16211621
{
16221622
struct iso_conn *conn = hcon->iso_data;
1623-
struct hci_iso_data_hdr *hdr;
16241623
__u16 pb, ts, len;
16251624

16261625
if (!conn)
@@ -1642,22 +1641,28 @@ void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
16421641
}
16431642

16441643
if (ts) {
1644+
struct hci_iso_ts_data_hdr *hdr;
1645+
16451646
/* TODO: add timestamp to the packet? */
16461647
hdr = skb_pull_data(skb, HCI_ISO_TS_DATA_HDR_SIZE);
16471648
if (!hdr) {
16481649
BT_ERR("Frame is too short (len %d)", skb->len);
16491650
goto drop;
16501651
}
16511652

1653+
len = __le16_to_cpu(hdr->slen);
16521654
} else {
1655+
struct hci_iso_data_hdr *hdr;
1656+
16531657
hdr = skb_pull_data(skb, HCI_ISO_DATA_HDR_SIZE);
16541658
if (!hdr) {
16551659
BT_ERR("Frame is too short (len %d)", skb->len);
16561660
goto drop;
16571661
}
1662+
1663+
len = __le16_to_cpu(hdr->slen);
16581664
}
16591665

1660-
len = __le16_to_cpu(hdr->slen);
16611666
flags = hci_iso_data_flags(len);
16621667
len = hci_iso_data_len(len);
16631668

0 commit comments

Comments
 (0)