Skip to content

Commit 876e781

Browse files
committed
Bluetooth: hci_core: Detect if an ACL packet is in fact an ISO packet
Because some transports don't have a dedicated type for ISO packets (see 14202ef) they may use ACL type when in fact they are ISO packets. In the past this was left for the driver to detect such thing but it creates a problem when using the likes of btproxy when used by a VM as the host would not be aware of the connection the guest is doing it won't be able to detect such behavior, so this make bt_recv_frame detect when it happens as it is the common interface to all drivers including guest VMs. Fixes: 14202ef ("Bluetooth: btusb: Detect if an ACL packet is in fact an ISO packet") Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent 3c44a43 commit 876e781

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

net/bluetooth/hci_core.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2871,10 +2871,25 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
28712871
return -ENXIO;
28722872
}
28732873

2874-
if (hci_skb_pkt_type(skb) != HCI_EVENT_PKT &&
2875-
hci_skb_pkt_type(skb) != HCI_ACLDATA_PKT &&
2876-
hci_skb_pkt_type(skb) != HCI_SCODATA_PKT &&
2877-
hci_skb_pkt_type(skb) != HCI_ISODATA_PKT) {
2874+
switch (hci_skb_pkt_type(skb)) {
2875+
case HCI_EVENT_PKT:
2876+
break;
2877+
case HCI_ACLDATA_PKT:
2878+
/* Detect if ISO packet has been sent as ACL */
2879+
if (hci_conn_num(hdev, ISO_LINK)) {
2880+
__u16 handle = __le16_to_cpu(hci_acl_hdr(skb)->handle);
2881+
__u8 type;
2882+
2883+
type = hci_conn_lookup_type(hdev, hci_handle(handle));
2884+
if (type == ISO_LINK)
2885+
hci_skb_pkt_type(skb) = HCI_ISODATA_PKT;
2886+
}
2887+
break;
2888+
case HCI_SCODATA_PKT:
2889+
break;
2890+
case HCI_ISODATA_PKT:
2891+
break;
2892+
default:
28782893
kfree_skb(skb);
28792894
return -EINVAL;
28802895
}

0 commit comments

Comments
 (0)