Skip to contentSkip to conversation

Bluetooth: Ignore unknown advertising packet types

PATCH In review Johan Hedberg 2 participants 2 messages Apr 7, 2016 – Apr 8, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Bluetooth: Ignore unknown advertising packet types

From: Johan Hedberg <[email protected]>

In case of buggy controllers send advertising packet types that we don't know of we should simply ignore them instead of trying to react to them in some (potentially wrong) way.

---
 net/bluetooth/hci_event.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)
net/bluetooth/hci_event.c +13 -0
index c162af5d16bf..d4b3dd5413be 100644
@@ -4727,6 +4727,19 @@ static void process_adv_report(struct hci_dev *hdev, u8 type, bdaddr_t *bdaddr,
 	u32 flags;
 	u8 *ptr, real_len;
 
+	switch (type) {
+	case LE_ADV_IND:
+	case LE_ADV_DIRECT_IND:
+	case LE_ADV_SCAN_IND:
+	case LE_ADV_NONCONN_IND:
+	case LE_ADV_SCAN_RSP:
+		break;
+	default:
+		BT_ERR_RATELIMITED("Unknown advetising packet type: 0x%02x",
+				   type);
+		return;
+	}
+
 	/* Find the end of the data in case the report contains padded zero
 	 * bytes at the end causing an invalid length value.
 	 *
Signature · 1 line
2.5.5
maintainer
#1 lore raw

Hi Johan,

Quoted 8 lines

In case of buggy controllers send advertising packet types that we don't know of we should simply ignore them instead of trying to react to them in some (potentially wrong) way.

---
net/bluetooth/hci_event.c | 13 +++++++++++++

1 file changed, 13 insertions(+)

patch has been applied to bluetooth-next tree.

Regards

Marcel