public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Tristan Madani <tristmd@gmail.com>
To: Luiz Augusto von Dentz <luiz.dentz@gmail.com>
Cc: Marcel Holtmann <marcel@holtmann.org>, linux-bluetooth@vger.kernel.org
Subject: [PATCH v2] Bluetooth: btintel: fix OOB read from short TLV values in version parser
Date: Wed, 15 Apr 2026 22:25:00 +0000	[thread overview]
Message-ID: <20260415222500.1547797-1-tristmd@gmail.com> (raw)

From: Tristan Madani <tristan@talencesecurity.com>

The TLV parser validates that tlv->len fits in the SKB but not that it
meets the minimum size required by each type-specific read. Short TLV
values cause out-of-bounds reads from SKB data.

Add length checks for types that read fixed-size values (le32, le16,
bdaddr_t).

Fixes: ca5425e15881 ("Bluetooth: btintel: Add combined setup and shutdown functions")
Signed-off-by: Tristan Madani <tristan@talencesecurity.com>
---
Note: v2 resubmission -- original sent via Gmail had HTML rendering
issues. This version uses git send-email for plain-text formatting.

drivers/bluetooth/btintel.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index XXXXXXX..XXXXXXX 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -582,18 +582,34 @@ int btintel_parse_version_tlv(struct hci_dev *hdev,
 		switch (tlv->type) {
 		case INTEL_TLV_CNVI_TOP:
+			if (tlv->len < 4)
+				return -EINVAL;
 			version->cnvi_top = get_unaligned_le32(tlv->val);
 			break;
 		case INTEL_TLV_CNVR_TOP:
+			if (tlv->len < 4)
+				return -EINVAL;
 			version->cnvr_top = get_unaligned_le32(tlv->val);
 			break;
 		case INTEL_TLV_CNVI_BT:
+			if (tlv->len < 4)
+				return -EINVAL;
 			version->cnvi_bt = get_unaligned_le32(tlv->val);
 			break;
 		case INTEL_TLV_CNVR_BT:
+			if (tlv->len < 4)
+				return -EINVAL;
 			version->cnvr_bt = get_unaligned_le32(tlv->val);
 			break;
+		case INTEL_TLV_OTP_BDADDR:
+			if (tlv->len < sizeof(bdaddr_t))
+				return -EINVAL;
+			memcpy(&version->otp_bd_addr, tlv->val, sizeof(bdaddr_t));
+			break;
+		case INTEL_TLV_BUILD_NUM:
+			if (tlv->len < 4)
+				return -EINVAL;
+			version->min_fw_build_nn = tlv->val[0];
+			version->build_num = get_unaligned_le32(tlv->val);
+			break;


                 reply	other threads:[~2026-04-15 22:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260415222500.1547797-1-tristmd@gmail.com \
    --to=tristmd@gmail.com \
    --cc=linux-bluetooth@vger.kernel.org \
    --cc=luiz.dentz@gmail.com \
    --cc=marcel@holtmann.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox