mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2025-01-01 02:33:57 +00:00
Bluetooth: hci_event: Fix HCI_EV_VENDOR max_len
HCI_EV_VENDOR is in fact variable length since it acts as metaevent
where a vendor can implement their own event sets.
In addition to it this makes use of bt_dev_warn_ratelimited to supress
the amount of logging in case the event has more data than expected.
Fixes: 3e54c5890c
("Bluetooth: hci_event: Use of a function table to handle HCI event")
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
This commit is contained in:
parent
2d4b37b67c
commit
314d8cd278
@ -6844,7 +6844,7 @@ static const struct hci_ev {
|
||||
HCI_EV(HCI_EV_NUM_COMP_BLOCKS, hci_num_comp_blocks_evt,
|
||||
sizeof(struct hci_ev_num_comp_blocks)),
|
||||
/* [0xff = HCI_EV_VENDOR] */
|
||||
HCI_EV(HCI_EV_VENDOR, msft_vendor_evt, 0),
|
||||
HCI_EV_VL(HCI_EV_VENDOR, msft_vendor_evt, 0, HCI_MAX_EVENT_SIZE),
|
||||
};
|
||||
|
||||
static void hci_event_func(struct hci_dev *hdev, u8 event, struct sk_buff *skb,
|
||||
@ -6869,8 +6869,9 @@ static void hci_event_func(struct hci_dev *hdev, u8 event, struct sk_buff *skb,
|
||||
* decide if that is acceptable.
|
||||
*/
|
||||
if (skb->len > ev->max_len)
|
||||
bt_dev_warn(hdev, "unexpected event 0x%2.2x length: %u > %u",
|
||||
event, skb->len, ev->max_len);
|
||||
bt_dev_warn_ratelimited(hdev,
|
||||
"unexpected event 0x%2.2x length: %u > %u",
|
||||
event, skb->len, ev->max_len);
|
||||
|
||||
data = hci_ev_skb_pull(hdev, skb, event, ev->min_len);
|
||||
if (!data)
|
||||
|
Loading…
Reference in New Issue
Block a user