Skip to content
/ linux Public
forked from torvalds/linux

Commit

Permalink
Bluetooth: ISO: fix timestamped HCI ISO data packet parsing
Browse files Browse the repository at this point in the history
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 <pav@iki.fi>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
  • Loading branch information
pv authored and Vudentz committed Mar 22, 2023
1 parent efe375b commit 2f10e40
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions net/bluetooth/iso.c
Original file line number Diff line number Diff line change
Expand Up @@ -1620,7 +1620,6 @@ static void iso_disconn_cfm(struct hci_conn *hcon, __u8 reason)
void iso_recv(struct hci_conn *hcon, struct sk_buff *skb, u16 flags)
{
struct iso_conn *conn = hcon->iso_data;
struct hci_iso_data_hdr *hdr;
__u16 pb, ts, len;

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

if (ts) {
struct hci_iso_ts_data_hdr *hdr;

/* TODO: add timestamp to the packet? */
hdr = skb_pull_data(skb, HCI_ISO_TS_DATA_HDR_SIZE);
if (!hdr) {
BT_ERR("Frame is too short (len %d)", skb->len);
goto drop;
}

len = __le16_to_cpu(hdr->slen);
} else {
struct hci_iso_data_hdr *hdr;

hdr = skb_pull_data(skb, HCI_ISO_DATA_HDR_SIZE);
if (!hdr) {
BT_ERR("Frame is too short (len %d)", skb->len);
goto drop;
}

len = __le16_to_cpu(hdr->slen);
}

len = __le16_to_cpu(hdr->slen);
flags = hci_iso_data_flags(len);
len = hci_iso_data_len(len);

Expand Down

0 comments on commit 2f10e40

Please sign in to comment.