Skip to contentSkip to conversation

Bluetooth: Enforce packet types in hci_recv_frame driver function

PATCH Applied Marcel Holtmann 2 participants 2 messages Oct 8, 2015

Subsystems (2)
lore
Share & tools
lore

Marcel Holtmann

author maintainer
#0 lore raw

PATCH 1/1 Bluetooth: Enforce packet types in hci_recv_frame driver function

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.

---
 net/bluetooth/hci_core.c | 7 +++++++
 1 file changed, 7 insertions(+)
net/bluetooth/hci_core.c +7 -0
index 43a1f2d8ffd3..b2095ca8472e 100644
@@ -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;
 
Signature · 1 line
2.4.3
#1 lore raw

Hi Marcel,

Quoted 8 lines · Marcel Holtmann

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.

---
 net/bluetooth/hci_core.c | 7 +++++++
 1 file changed, 7 insertions(+)

Applied to bluetooth-next. Thanks.

Johan