]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Bluetooth: btintel: Validate length before parsing diagnostics TLV
authorZijun Hu <zijun.hu@oss.qualcomm.com>
Sat, 25 Jul 2026 08:54:40 +0000 (01:54 -0700)
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>
Tue, 28 Jul 2026 20:13:12 +0000 (16:13 -0400)
btintel_diagnostics() accesses tlv->val[0] without first validating
that the diagnostics VSE is long enough to contain that field, so
may cause reading data beyond the received frame.

Fix by validating the length before access.

Fixes: af395330abed ("Bluetooth: btintel: Add Intel devcoredump support")
Signed-off-by: Zijun Hu <zijun.hu@oss.qualcomm.com>
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
drivers/bluetooth/btintel.c

index 5e9cac090bd8f402a7ff437b40a9a77bac2ef6d2..bf567b7c5f00b52be44ab8357eeebf781bb3a356 100644 (file)
@@ -3771,6 +3771,9 @@ static int btintel_diagnostics(struct hci_dev *hdev, struct sk_buff *skb)
 {
        struct intel_tlv *tlv = (void *)&skb->data[5];
 
+       if (skb->len < 5 + sizeof(*tlv) + sizeof(tlv->val[0]))
+               goto recv_frame;
+
        /* The first event is always an event type TLV */
        if (tlv->type != INTEL_TLV_TYPE_ID)
                goto recv_frame;