Bluetooth: Ignore unknown advertising packet types
authorJohan Hedberg <johan.hedberg@intel.com>
Thu, 7 Apr 2016 18:01:27 +0000 (21:01 +0300)
committerMarcel Holtmann <marcel@holtmann.org>
Fri, 8 Apr 2016 16:51:44 +0000 (18:51 +0200)
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.

Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
net/bluetooth/hci_event.c

index c162af5d16bf3d4367a058f920d95cb1747ab925..d4b3dd5413bef561c3c273d354b6d25ef7465153 100644 (file)
@@ -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.
         *