Skip to content

Commit

Permalink
Bluetooth: Enforce packet types in hci_recv_frame driver function
Browse files Browse the repository at this point in the history
When calling the hci_recv_frame driver function check for valid packet
types that the core should process. This should catch issues with
drivers trying to feed vendor packet types through this interface.

Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
  • Loading branch information
Marcel Holtmann authored and Johan Hedberg committed Oct 8, 2015
1 parent 943cc59 commit fe806dc
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions net/bluetooth/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3538,6 +3538,13 @@ int hci_recv_frame(struct hci_dev *hdev, struct sk_buff *skb)
return -ENXIO;
}

if (bt_cb(skb)->pkt_type != HCI_EVENT_PKT &&
bt_cb(skb)->pkt_type != HCI_ACLDATA_PKT &&
bt_cb(skb)->pkt_type != HCI_SCODATA_PKT) {
kfree_skb(skb);
return -EINVAL;
}

/* Incoming skb */
bt_cb(skb)->incoming = 1;

Expand Down

0 comments on commit fe806dc

Please sign in to comment.