* [PATCH v3 1/3] Bluetooth: btintel: validate version TLV value lengths
2026-08-31 9:59 ` [PATCH v3 0/3] Bluetooth: btintel: harden version TLV parsing Laxman Acharya Padhya
@ 2026-08-31 9:59 ` Laxman Acharya Padhya
2026-08-31 11:05 ` K, Kiran
2026-08-31 12:29 ` Bluetooth: btintel: harden version TLV parsing bluez.test.bot
2026-08-31 9:59 ` [PATCH v3 2/3] Bluetooth: btintel: bound firmware ID by TLV length Laxman Acharya Padhya
` (2 subsequent siblings)
3 siblings, 2 replies; 15+ messages in thread
From: Laxman Acharya Padhya @ 2026-08-31 9:59 UTC (permalink / raw)
To: linux-bluetooth
Cc: marcel, luiz.dentz, linux-kernel, ali, kiraank, kiran.k,
ravishankar.srivatsa, amit.k.bag, Laxman Acharya Padhya
btintel_parse_version_tlv() verifies that a complete TLV is present in
the response, but it does not ensure that the value is long enough for
the specific TLV type. A short value can therefore cause an
out-of-bounds read through get_unaligned_le16(), get_unaligned_le32(),
or memcpy().
Reject values shorter than the minimum required by each known TLV type.
Also reject responses that do not contain the Command Complete Status
field.
Fixes: 57375beef71a ("Bluetooth: btintel: Add infrastructure to read controller information")
Reviewed-by: Ali Ahmet Memis <ali@iusegentoo.com>
Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
---
drivers/bluetooth/btintel.c | 37 ++++++++++++++++++++++++++++++++++++-
1 file changed, 36 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index cbeb27033..998c99b17 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -573,12 +573,44 @@ int btintel_version_info_tlv(struct hci_dev *hdev,
}
EXPORT_SYMBOL_GPL(btintel_version_info_tlv);
+static u8 btintel_version_tlv_min_len(u8 type)
+{
+ switch (type) {
+ case INTEL_TLV_CNVI_TOP:
+ case INTEL_TLV_CNVR_TOP:
+ case INTEL_TLV_CNVI_BT:
+ case INTEL_TLV_CNVR_BT:
+ case INTEL_TLV_BUILD_NUM:
+ case INTEL_TLV_GIT_SHA1:
+ return sizeof(u32);
+ case INTEL_TLV_DEV_REV_ID:
+ case INTEL_TLV_TIME_STAMP:
+ return sizeof(u16);
+ case INTEL_TLV_IMAGE_TYPE:
+ case INTEL_TLV_BUILD_TYPE:
+ case INTEL_TLV_SECURE_BOOT:
+ case INTEL_TLV_OTP_LOCK:
+ case INTEL_TLV_API_LOCK:
+ case INTEL_TLV_DEBUG_LOCK:
+ case INTEL_TLV_LIMITED_CCE:
+ case INTEL_TLV_SBE_TYPE:
+ return sizeof(u8);
+ case INTEL_TLV_MIN_FW:
+ return 3;
+ case INTEL_TLV_OTP_BDADDR:
+ return sizeof(bdaddr_t);
+ default:
+ return 0;
+ }
+}
+
int btintel_parse_version_tlv(struct hci_dev *hdev,
struct intel_version_tlv *version,
struct sk_buff *skb)
{
/* Consume Command Complete Status field */
- skb_pull(skb, 1);
+ if (!skb_pull(skb, 1))
+ return -EINVAL;
/* Event parameters contain multiple TLVs. Read each of them
* and only keep the required data. Also, it use existing legacy
@@ -598,6 +630,9 @@ int btintel_parse_version_tlv(struct hci_dev *hdev,
if (skb->len < tlv->len + sizeof(*tlv))
return -EINVAL;
+ if (tlv->len < btintel_version_tlv_min_len(tlv->type))
+ return -EINVAL;
+
switch (tlv->type) {
case INTEL_TLV_CNVI_TOP:
version->cnvi_top = get_unaligned_le32(tlv->val);
--
2.51.2
^ permalink raw reply related [flat|nested] 15+ messages in thread* RE: [PATCH v3 1/3] Bluetooth: btintel: validate version TLV value lengths
2026-08-31 9:59 ` [PATCH v3 1/3] Bluetooth: btintel: validate version TLV value lengths Laxman Acharya Padhya
@ 2026-08-31 11:05 ` K, Kiran
2026-08-31 12:29 ` Bluetooth: btintel: harden version TLV parsing bluez.test.bot
1 sibling, 0 replies; 15+ messages in thread
From: K, Kiran @ 2026-08-31 11:05 UTC (permalink / raw)
To: Laxman Acharya Padhya, linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, luiz.dentz@gmail.com,
linux-kernel@vger.kernel.org, ali@iusegentoo.com,
kiraank@gmail.com, Srivatsa, Ravishankar, Bag, Amit K
Hi Luiz,
>Subject: [PATCH v3 1/3] Bluetooth: btintel: validate version TLV value lengths
>
>btintel_parse_version_tlv() verifies that a complete TLV is present in the
>response, but it does not ensure that the value is long enough for the specific
>TLV type. A short value can therefore cause an out-of-bounds read through
>get_unaligned_le16(), get_unaligned_le32(), or memcpy().
>
>Reject values shorter than the minimum required by each known TLV type.
>Also reject responses that do not contain the Command Complete Status field.
>
>Fixes: 57375beef71a ("Bluetooth: btintel: Add infrastructure to read controller
>information")
>Reviewed-by: Ali Ahmet Memis <ali@iusegentoo.com>
>Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
>---
> drivers/bluetooth/btintel.c | 37
>++++++++++++++++++++++++++++++++++++-
> 1 file changed, 36 insertions(+), 1 deletion(-)
>
>diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index
>cbeb27033..998c99b17 100644
>--- a/drivers/bluetooth/btintel.c
>+++ b/drivers/bluetooth/btintel.c
>@@ -573,12 +573,44 @@ int btintel_version_info_tlv(struct hci_dev *hdev, }
>EXPORT_SYMBOL_GPL(btintel_version_info_tlv);
>
>+static u8 btintel_version_tlv_min_len(u8 type) {
>+ switch (type) {
>+ case INTEL_TLV_CNVI_TOP:
>+ case INTEL_TLV_CNVR_TOP:
>+ case INTEL_TLV_CNVI_BT:
>+ case INTEL_TLV_CNVR_BT:
>+ case INTEL_TLV_BUILD_NUM:
>+ case INTEL_TLV_GIT_SHA1:
>+ return sizeof(u32);
>+ case INTEL_TLV_DEV_REV_ID:
>+ case INTEL_TLV_TIME_STAMP:
>+ return sizeof(u16);
>+ case INTEL_TLV_IMAGE_TYPE:
>+ case INTEL_TLV_BUILD_TYPE:
>+ case INTEL_TLV_SECURE_BOOT:
>+ case INTEL_TLV_OTP_LOCK:
>+ case INTEL_TLV_API_LOCK:
>+ case INTEL_TLV_DEBUG_LOCK:
>+ case INTEL_TLV_LIMITED_CCE:
>+ case INTEL_TLV_SBE_TYPE:
>+ return sizeof(u8);
>+ case INTEL_TLV_MIN_FW:
>+ return 3;
>+ case INTEL_TLV_OTP_BDADDR:
>+ return sizeof(bdaddr_t);
>+ default:
>+ return 0;
>+ }
>+}
>+
> int btintel_parse_version_tlv(struct hci_dev *hdev,
> struct intel_version_tlv *version,
> struct sk_buff *skb)
> {
> /* Consume Command Complete Status field */
>- skb_pull(skb, 1);
>+ if (!skb_pull(skb, 1))
>+ return -EINVAL;
>
> /* Event parameters contain multiple TLVs. Read each of them
> * and only keep the required data. Also, it use existing legacy @@ -
>598,6 +630,9 @@ int btintel_parse_version_tlv(struct hci_dev *hdev,
> if (skb->len < tlv->len + sizeof(*tlv))
> return -EINVAL;
>
>+ if (tlv->len < btintel_version_tlv_min_len(tlv->type))
>+ return -EINVAL;
>+
> switch (tlv->type) {
> case INTEL_TLV_CNVI_TOP:
> version->cnvi_top = get_unaligned_le32(tlv->val);
>--
>2.51.2
Tested-by: Kiran K <kiran.k@intel.com>
Thanks,
Kiran
^ permalink raw reply [flat|nested] 15+ messages in thread* RE: Bluetooth: btintel: harden version TLV parsing
2026-08-31 9:59 ` [PATCH v3 1/3] Bluetooth: btintel: validate version TLV value lengths Laxman Acharya Padhya
2026-08-31 11:05 ` K, Kiran
@ 2026-08-31 12:29 ` bluez.test.bot
1 sibling, 0 replies; 15+ messages in thread
From: bluez.test.bot @ 2026-08-31 12:29 UTC (permalink / raw)
To: linux-bluetooth, acharyalaxman8848
[-- Attachment #1: Type: text/plain, Size: 1181 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=1154381
---Test result---
Test Summary:
CheckPatch PASS 1.57 seconds
VerifyFixes PASS 0.11 seconds
VerifySignedoff PASS 0.10 seconds
GitLint PASS 0.75 seconds
SubjectPrefix PASS 0.30 seconds
BuildKernel PASS 18.50 seconds
CheckAllWarning PASS 21.85 seconds
CheckSparse PASS 20.30 seconds
BuildKernel32 PASS 18.52 seconds
CheckKernelLLVM SKIP 0.00 seconds
TestRunnerSetup PASS 314.40 seconds
IncrementalBuild PASS 22.21 seconds
Details
##############################
Test: CheckKernelLLVM - SKIP
Desc: Build kernel with LLVM + context analysis
Output:
Clang not found
https://github.com/bluez/bluetooth-next/pull/673
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 2/3] Bluetooth: btintel: bound firmware ID by TLV length
2026-08-31 9:59 ` [PATCH v3 0/3] Bluetooth: btintel: harden version TLV parsing Laxman Acharya Padhya
2026-08-31 9:59 ` [PATCH v3 1/3] Bluetooth: btintel: validate version TLV value lengths Laxman Acharya Padhya
@ 2026-08-31 9:59 ` Laxman Acharya Padhya
2026-08-31 11:05 ` K, Kiran
2026-08-31 9:59 ` [PATCH v3 3/3] Bluetooth: btintel: propagate version TLV parsing errors Laxman Acharya Padhya
2026-08-31 17:20 ` [PATCH v3 0/3] Bluetooth: btintel: harden version TLV parsing patchwork-bot+bluetooth
3 siblings, 1 reply; 15+ messages in thread
From: Laxman Acharya Padhya @ 2026-08-31 9:59 UTC (permalink / raw)
To: linux-bluetooth
Cc: marcel, luiz.dentz, linux-kernel, ali, kiraank, kiran.k,
ravishankar.srivatsa, amit.k.bag, Laxman Acharya Padhya
The firmware ID is treated as a NUL-terminated string even though the
TLV length is its only boundary. If the value does not contain a NUL
terminator, snprintf() can read beyond the received response.
Limit the conversion to the advertised TLV value length.
Fixes: 164c62f958f8 ("Bluetooth: btintel: Add firmware ID to firmware name")
Reviewed-by: Ali Ahmet Memis <ali@iusegentoo.com>
Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
---
drivers/bluetooth/btintel.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 998c99b17..887170534 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -704,7 +704,7 @@ int btintel_parse_version_tlv(struct hci_dev *hdev,
break;
case INTEL_TLV_FW_ID:
snprintf(version->fw_id, sizeof(version->fw_id),
- "%s", tlv->val);
+ "%.*s", tlv->len, tlv->val);
break;
default:
/* Ignore rest of information */
--
2.51.2
^ permalink raw reply related [flat|nested] 15+ messages in thread* RE: [PATCH v3 2/3] Bluetooth: btintel: bound firmware ID by TLV length
2026-08-31 9:59 ` [PATCH v3 2/3] Bluetooth: btintel: bound firmware ID by TLV length Laxman Acharya Padhya
@ 2026-08-31 11:05 ` K, Kiran
0 siblings, 0 replies; 15+ messages in thread
From: K, Kiran @ 2026-08-31 11:05 UTC (permalink / raw)
To: Laxman Acharya Padhya, linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, luiz.dentz@gmail.com,
linux-kernel@vger.kernel.org, ali@iusegentoo.com,
kiraank@gmail.com, Srivatsa, Ravishankar, Bag, Amit K
Hi Luiz,
>Subject: [PATCH v3 2/3] Bluetooth: btintel: bound firmware ID by TLV length
>
>The firmware ID is treated as a NUL-terminated string even though the TLV
>length is its only boundary. If the value does not contain a NUL terminator,
>snprintf() can read beyond the received response.
>
>Limit the conversion to the advertised TLV value length.
>
>Fixes: 164c62f958f8 ("Bluetooth: btintel: Add firmware ID to firmware name")
>Reviewed-by: Ali Ahmet Memis <ali@iusegentoo.com>
>Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
>---
> drivers/bluetooth/btintel.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
>diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index
>998c99b17..887170534 100644
>--- a/drivers/bluetooth/btintel.c
>+++ b/drivers/bluetooth/btintel.c
>@@ -704,7 +704,7 @@ int btintel_parse_version_tlv(struct hci_dev *hdev,
> break;
> case INTEL_TLV_FW_ID:
> snprintf(version->fw_id, sizeof(version->fw_id),
>- "%s", tlv->val);
>+ "%.*s", tlv->len, tlv->val);
> break;
> default:
> /* Ignore rest of information */
>--
>2.51.2
Tested-by: Kiran K <kiran.k@intel.com>
Thanks,
Kiran
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH v3 3/3] Bluetooth: btintel: propagate version TLV parsing errors
2026-08-31 9:59 ` [PATCH v3 0/3] Bluetooth: btintel: harden version TLV parsing Laxman Acharya Padhya
2026-08-31 9:59 ` [PATCH v3 1/3] Bluetooth: btintel: validate version TLV value lengths Laxman Acharya Padhya
2026-08-31 9:59 ` [PATCH v3 2/3] Bluetooth: btintel: bound firmware ID by TLV length Laxman Acharya Padhya
@ 2026-08-31 9:59 ` Laxman Acharya Padhya
2026-08-31 11:05 ` K, Kiran
2026-08-31 17:20 ` [PATCH v3 0/3] Bluetooth: btintel: harden version TLV parsing patchwork-bot+bluetooth
3 siblings, 1 reply; 15+ messages in thread
From: Laxman Acharya Padhya @ 2026-08-31 9:59 UTC (permalink / raw)
To: linux-bluetooth
Cc: marcel, luiz.dentz, linux-kernel, ali, kiraank, kiran.k,
ravishankar.srivatsa, amit.k.bag, Laxman Acharya Padhya
btintel_read_version_tlv() ignores the parser return value, so setup
continues with partially initialized version data after a malformed TLV
causes parsing to stop.
Return the parser error to the caller so an invalid response fails setup
instead of being treated as successful. Keep this behavioral change
separate from the bounds checks so it can be reverted independently if
an existing controller sends malformed data.
Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
Reviewed-by: Ali Ahmet Memis <ali@iusegentoo.com>
---
drivers/bluetooth/btintel.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c
index 887170534..964d2de30 100644
--- a/drivers/bluetooth/btintel.c
+++ b/drivers/bluetooth/btintel.c
@@ -723,6 +723,7 @@ static int btintel_read_version_tlv(struct hci_dev *hdev,
{
struct sk_buff *skb;
const u8 param[1] = { 0xFF };
+ int err;
if (!version)
return -EINVAL;
@@ -741,10 +742,10 @@ static int btintel_read_version_tlv(struct hci_dev *hdev,
return -EIO;
}
- btintel_parse_version_tlv(hdev, version, skb);
+ err = btintel_parse_version_tlv(hdev, version, skb);
kfree_skb(skb);
- return 0;
+ return err;
}
/* ------- REGMAP IBT SUPPORT ------- */
--
2.51.2
^ permalink raw reply related [flat|nested] 15+ messages in thread* RE: [PATCH v3 3/3] Bluetooth: btintel: propagate version TLV parsing errors
2026-08-31 9:59 ` [PATCH v3 3/3] Bluetooth: btintel: propagate version TLV parsing errors Laxman Acharya Padhya
@ 2026-08-31 11:05 ` K, Kiran
0 siblings, 0 replies; 15+ messages in thread
From: K, Kiran @ 2026-08-31 11:05 UTC (permalink / raw)
To: Laxman Acharya Padhya, linux-bluetooth@vger.kernel.org
Cc: marcel@holtmann.org, luiz.dentz@gmail.com,
linux-kernel@vger.kernel.org, ali@iusegentoo.com,
kiraank@gmail.com, Srivatsa, Ravishankar, Bag, Amit K
Hi Luiz,
>Subject: [PATCH v3 3/3] Bluetooth: btintel: propagate version TLV parsing errors
>
>btintel_read_version_tlv() ignores the parser return value, so setup continues
>with partially initialized version data after a malformed TLV causes parsing to
>stop.
>
>Return the parser error to the caller so an invalid response fails setup instead
>of being treated as successful. Keep this behavioral change separate from the
>bounds checks so it can be reverted independently if an existing controller
>sends malformed data.
>
>Signed-off-by: Laxman Acharya Padhya <acharyalaxman8848@gmail.com>
>Reviewed-by: Ali Ahmet Memis <ali@iusegentoo.com>
>---
> drivers/bluetooth/btintel.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
>diff --git a/drivers/bluetooth/btintel.c b/drivers/bluetooth/btintel.c index
>887170534..964d2de30 100644
>--- a/drivers/bluetooth/btintel.c
>+++ b/drivers/bluetooth/btintel.c
>@@ -723,6 +723,7 @@ static int btintel_read_version_tlv(struct hci_dev *hdev,
>{
> struct sk_buff *skb;
> const u8 param[1] = { 0xFF };
>+ int err;
>
> if (!version)
> return -EINVAL;
>@@ -741,10 +742,10 @@ static int btintel_read_version_tlv(struct hci_dev
>*hdev,
> return -EIO;
> }
>
>- btintel_parse_version_tlv(hdev, version, skb);
>+ err = btintel_parse_version_tlv(hdev, version, skb);
>
> kfree_skb(skb);
>- return 0;
>+ return err;
> }
>
> /* ------- REGMAP IBT SUPPORT ------- */
>--
>2.51.2
Tested-by: Kiran K <kiran.k@intel.com>
Thanks,
Kiran
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH v3 0/3] Bluetooth: btintel: harden version TLV parsing
2026-08-31 9:59 ` [PATCH v3 0/3] Bluetooth: btintel: harden version TLV parsing Laxman Acharya Padhya
` (2 preceding siblings ...)
2026-08-31 9:59 ` [PATCH v3 3/3] Bluetooth: btintel: propagate version TLV parsing errors Laxman Acharya Padhya
@ 2026-08-31 17:20 ` patchwork-bot+bluetooth
3 siblings, 0 replies; 15+ messages in thread
From: patchwork-bot+bluetooth @ 2026-08-31 17:20 UTC (permalink / raw)
To: Laxman Acharya Padhya
Cc: linux-bluetooth, marcel, luiz.dentz, linux-kernel, ali, kiraank,
kiran.k, ravishankar.srivatsa, amit.k.bag
Hello:
This series was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Mon, 31 Aug 2026 15:44:20 +0545 you wrote:
> Malformed Intel version TLVs can make btintel_parse_version_tlv() read
> beyond the received response. Validate the minimum value length for each
> known fixed-size TLV and bound the firmware ID conversion by the TLV's
> advertised length. Propagate parser failures to the setup path in a
> separate patch.
>
> The two bounds fixes are kept separate because they were introduced by
> different commits and apply to different stable trees. The parser error
> propagation is also separate because it changes setup behavior.
>
> [...]
Here is the summary with links:
- [v3,1/3] Bluetooth: btintel: validate version TLV value lengths
https://git.kernel.org/bluetooth/bluetooth-next/c/eb656c5bb754
- [v3,2/3] Bluetooth: btintel: bound firmware ID by TLV length
https://git.kernel.org/bluetooth/bluetooth-next/c/58c6f5ec1d22
- [v3,3/3] Bluetooth: btintel: propagate version TLV parsing errors
https://git.kernel.org/bluetooth/bluetooth-next/c/f8c8fa407aa0
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 15+ messages in thread